0
Please, explain why there is only one value printed in output of this example. Why doesn't range (5) work?
import random def fox(a,b,c): for i in range (a): x = random.randit(b,c) print (x) fox(5,1,6)
4 Respostas
+ 10
so like Alvaro said, it would be:
import random
def fox(a,b,c):
for i in range (a):
x = random.randit(b,c)
print (x)
fox(5,1,6)
keep on being foxy!~ awoo
+ 3
print(x) is outside the for loop (and outside the function, as well).
+ 2
Thanks! You helped a lot!
+ 1
Thank you so much! Now I realised the importance of line position.