0

So Im making game Rock,paper,Scissors and my problem is I keep getting None value after calling variable that contains randomly chosen string from list ''tools''.

import random

tools =["Rock","Scissors","Paper"]
def computer_predicion():
    computer_pred = random.choice(tools)
print(computer_predicion())
Ivo Sorokins
  • 17
  • 1
  • 8

1 Answers1

0

You are missing your return statement in the function. When there is no return value specified, it will return None which is what you're seeing on your console when you print it to console. The return statement has to be inside the function.

import random

tools =["Rock","Scissors","Paper"]
def computer_predicion():
    computer_pred = random.choice(tools)
    return computer_pred
print(computer_predicion())