I created 2 different python files. The first file named "game.py" has the code:
h = int(input("Pick number 1 or 2: "))
def game():
if h == 1:
print ("You lose!")
if h == 2:
print ("You win!")
def play_again():
rounds = input("Play again? (Y/N): ")
if rounds == "Y":
game()
if rounds == "NO":
print ("Game Over")
As shown, I have 2 functions in this file.
Then I created another file with my main function that calls these 2 functions. The following is the code inside it:
import game
def main():
game.game()
game.play_again()
main()
When I run this on the console, it prints "Pick number 1 or 2: ". But if I run it again, it prints "Play again? (Y/N): ".
How do I fix this so that it only prints "Pick number 1 or 2 : " whenever I run the code?