my first post here. I am trying out Python and I am stuck with “Game of Chance”.
I realize that it is very very simple. But I am trying to make it first and increase the difficulty later in the next step, using e.g. while loops and so on. So I am not looking for a complete new solution. My question concerns the code below.
When I run it it gives me either 85 (loss) or 115 (win) which is correct. However the print statements give me a hard time. It does not print what I want it to print. Whatever I print() is not printed at all. And I do not understand why it prints 85 or 115 even when there is no print() statement at all.
This must be very noobish for you. But still I would be thankful for an answer.
Link to project:
import random #Write your game of chance functions here def coinFlip (guess, bet): flip = random.randint(1,2) money = 100 if flip == guess: money += bet return money print("something") if flip != guess: money -= bet return money print("something else") #Call your game of chance functions here start = coinFlip(1,15) print(start)