How do i make it not say none | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 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())

26th Sep 2020, 4:57 PM
Somebody
Somebody - avatar
7 Answers
+ 9
some issues: 1. please check indents 2. random is a module, you should not name a variable like that.
26th Sep 2020, 5:19 PM
Oma Falk
Oma Falk - avatar
+ 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()
26th Sep 2020, 5:47 PM
Jayakrishna 🇮🇳
+ 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()
26th Sep 2020, 6:38 PM
Jayakrishna 🇮🇳
0
ok
26th Sep 2020, 5:41 PM
Somebody
Somebody - avatar
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?
26th Sep 2020, 5:58 PM
Somebody
Somebody - avatar
0
thank you brother
26th Sep 2020, 7:29 PM
Somebody
Somebody - avatar
0
You're welcome..
27th Sep 2020, 6:54 PM
Jayakrishna 🇮🇳