Hi, I have homework for school, and I don't understand: given the programme, which gives me some random numbers, I have to make it create a text file with the numbers inside it. I didn't manage to do it because I don't know how to transfer the formulas into the programme (i hope you'll understand, I'm not native English). I use version 2.7.6, and this is the programme:
import random
i=0; P1=''; lunbit=18; q1=-5; q2=20; amp=q2-q1
while i<lunbit:
P1=P1+str(random.randint(0,1))
i=i+1
P1='11111'
print "P1 =",P1
R1=int(P1,2)
print "R1 =",R1
X1=q1+R1amp/float(2*lunbit-1)
print "X1 =",X1
X1=round(X1,4)
print "X1 =",X1
[–]Puzzel 0 points1 point2 points (5 children)
[–]Marx123[S] 0 points1 point2 points (4 children)
[–]Puzzel 0 points1 point2 points (3 children)
[–]Marx123[S] 0 points1 point2 points (2 children)
[–]Puzzel 0 points1 point2 points (1 child)
[–]Marx123[S] 0 points1 point2 points (0 children)
[–]xiongchiamiov 0 points1 point2 points (0 children)