0
Python: I can't make this work.....
c1 = [] from random import randint for cc in range (1): c1 = randint(0,10) if c1 == (0-9): print "gun" elif c1 == (10): print "laser" If I'm not mistaken, its the 5th line that's giving me the problem... help?
7 Answers
+ 1
thank you that fixed it!
0
You must to write double dot " : "
0
I have it in my original program XD it was lost in translation.
0
Jajaj oh well. I was editing my code right now. This works in Python 2.7
But in 3.X (Sololearn uses this) the print function must be written with parenthesis:
print("gun")
print("laser")
Edit: Oh god, I forgot something, I'll write the solution again
0
okay that sounds interesting. but my main problem is the (0-9) on line 5. I don't know how to code for that.
0
In the five line, you can't write 0-9 to represent numbers between them. I would write that line like:
if c1 in range(9):
0
I'm sorry, you have to write range(10)
With this you are asking if c1 is some number of here: (0,1,2,3,4,5,6,7,8,9) not including the number 10