+ 1

why is my code not working

num = 1 if num == 1: print("hi") two = 2 if two == 2: print("bye") import random print(random.randint(1,2))

17th Mar 2022, 8:47 PM
Cooper Manley
7 Answers
+ 2
import random num = random.randint(1,2) #generate a num print(num) #check what it returned by print if num == 1: print("hi") elif num == 2: print("bye") # if it is 1 print hi else if it is 2 print bye #hope it helps...
17th Mar 2022, 8:59 PM
Jayakrishna 🇼🇳
0
What not working in code?
17th Mar 2022, 8:49 PM
Jayakrishna 🇼🇳
0
Yones Mussa its supposed to say if the randomizer hits 1, it prints hi, if it hits 2, it prints hi as the output, im a beginner so im sorry if this question sounds stupid
17th Mar 2022, 8:54 PM
Cooper Manley
0
Thanks a lot!
17th Mar 2022, 9:00 PM
Cooper Manley
0
I hope this will work!
17th Mar 2022, 9:00 PM
Cooper Manley
0
Read comments in code to understand. You're welcome..
17th Mar 2022, 9:02 PM
Jayakrishna 🇼🇳
- 1
Whats not working
17th Mar 2022, 8:49 PM
Yones Mussa