[Solved] Python if and else


You don’t want to use the function random.choice in your if statement.

Save the random name as a variable and check it.

import random

random_choice = ['Noob', 'Average', 'Pro', 'Expert']

name = input('What is your gamername? ')

random_name = random.choice(random_choice)

print(name, 'is a', random_name, 'Gamer')

if random_name == 'Noob':
    print('Im afraid there is nothing to be done')
else:
    print('Have a Nice Day', name)

2

solved Python if and else