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")

27th Sep 2018, 3:34 PM
Joe
Joe - avatar
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")
27th Sep 2018, 3:51 PM
KrOW
KrOW - avatar
+ 1
you dont need to import random 2 times,write it 1 time in top of the code
27th Sep 2018, 4:05 PM
gil gil