0

I have been working on a "guess the dice number" game, and everything seems to work except for the dice function. When I run the program I am able to input my number and it will tell me whether I lost or won. But if I do manage to guess the correct number it says this (user input comes after the ">"):

What number will the dice role on?
>3
loser
3

I guessed the right number but it still said "loser" when it should say "winner". I assume it either has something to do with the == or the if statement.

import random

def Func():
    A = random.randint(1,6)
    def dice(A):
        print("What number will the dice role on?")
        bet = input(">")
        if bet == A:
            print("Winner!")
            print(A)
        else:
            print("Loser")
            print(A)
    dice(A)        
    B = print("would you like to go again?")        
    def again(B):
        YN = input("Y/N-")
        if YN == "y":
            Func()
        else:
            print("Good bye!")
    again(B)             
Func()
Cœur
  • 37,241
  • 25
  • 195
  • 267

0 Answers0