Hi all,

how can i make my code return the value that is typed after return, running all the code i have after return and then it also prints “none” which is the valued that was returned?

thank you

//////////////////// code below \\\\\\\\\\\

``````import random

money = 100

#Write your game of chance functions here
def coin_flip(guess, bet):
num = random.randint(1, 2)
if num == 1:
if num == 2:
num = "Tails"
print(num)

profit = bet * 2
loss = bet / 2

if guess == num:
return (print("You have won this match. Your guess was " + str(guess) + " and your bet was " + str(bet) + ". Your winnings for this match are " + str(profit) + " and your new total is " + str(money + profit)))
elif guess != num:
return (print("You lost this match. Your guess was " + str(guess) + " and your bet was " + str(bet) + ". Your losses for this match are " + str(loss) + " and your new total is " + str(money - loss)))
else:
return "You must chooese either head or tails"

`return` is a statement, so don’t use parentheses:
``````return "some value"
the none is caused by the fact that the `print()` functions returns None (although, technically None indicates the absence of a return value)