The whole idea was to get acquainted with basics of python. So I wanted to generate some random data, use some conditionals, use one external package (in this case random), to have at least one loop, get input from the keyboard, print out the data, both on screen and to a file and format the data on the file for more ease of reading.
I was purposefully sloppy with not verifying the data, nor converting it to float values, to see how it would read it. It guessed correctly with the input I gave it. The file is controlled by fout that opens the file ‘data.txt’ for output. It is an object that lets you write to it. It’s really not a bad first program, for a beginner MCMC code. Notice that there are no type declarations. These would have made the equivalent c code longer.
s2= input(“Input bias: a number between 0 and 1”)
digits1= input(“How many digits?”)
if s<0.5: x=0 else: x=1 fout=open("data.txt", 'w') j=0 while j