- 2
How do i make it not say none
import random random_player = [1, 2] random_player2 = random.choice(random_player) random_values = ["1", "22", "333", "4444", "55555", "666666"] random = random.choice(random_values) def non_toxic(): print("good game") return def toxic(): for i in random: print("ez") continue return if random_player2 == 1: print(non_toxic()) else: print(toxic())
7 ответов
+ 9
some issues:
1. please check indents
2. random is a module, you should not name a variable like that.
+ 2
You're not returning anything from function so then remove return in function definition..
And also just put like this..
if random_player2 == 1:
non_toxic()
else:
toxic()
+ 2
random_values = ["1", "22", "333", "4444", "55555", "666666"] use this as it is. Here values are strings but in your modified code list have numbers. Don't work for loop iterable.
Thinkboy123 corrected code :
import random
random_player = random.choice([1, 2])
random_values = random.choice(["1", "22", "333", "4444", "55555", "666666"])
def non_toxic():
print("good game")
def toxic():
for i in random_values:
print("ez") #add ident here
if random_player == 1:
non_toxic()
else:
toxic()
0
ok
0
import random
random_player = random.choice([1, 2])
random_values = random.choice([1, 22, 333, 4444, 55555, 666666])
def non_toxic():
print("good game")
def toxic():
for i in random_values:
print("ez")
if random_player == 1:
non_toxic()
else:
toxic()
is this good?
0
thank you brother
0
You're welcome..