0
Why it doesn't functions!?!?
print("Options: 1 - Random Love, 2 - Play") x = input("Select your option, please: ") if x == ("1"): import random list = ["Nava", "Paula", "Lou"] print("You love " + random.choice(list)) elif x == ("2"): import random nums = ["1", "2", "3", "4", "5", "6"] print("Your number is: " + random.choice(list)) else: print("False function")
2 Answers
+ 2
You indendation is bad. Futhermore use a variable thats dont declared in that scope. Correct code is:
print("Options: 1 - Random Love, 2 - Play")
x = input("Select your option, please: ")
if x == ("1"):
import random
list = ["Nava", "Paula", "Lou"]
print("You love " + random.choice(list))
elif x == ("2"):
import random
nums = ["1", "2", "3", "4", "5", "6"]
# you want choice in "nums" dont in "list"
print("Your number is: " + random.choice(nums))
else:
print("False function")
+ 1
you dont need to import random 2 times,write it 1 time in top of the code