0

Why does this code not work?

Why does this code not work?: import random for i in range(1): value=random.randint(1,8) if value=1: print(threat)

20th Aug 2016, 11:46 PM
Ezie
3 Answers
+ 2
Put indent and use == for condition
21st Aug 2016, 1:48 AM
Sohan Singh Rajpurohit
+ 1
Put the indent on the print(threat) The code would be: import random for i in range(1): value=random.randint(1,8) if value=1: print(threat)
21st Aug 2016, 12:39 AM
Replicadoe
+ 1
the if statement should have double equals sign for it i.e.: if value==1: print(threat)
21st Aug 2016, 12:42 AM
Replicadoe