Python Forum
Please help with code below!
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Please help with code below!
#1
from time import sleep
print("Welcome to my first game")
char_name = ""
def choosingname(name):
    name = input("What is your charactar's name?: ")
    print(name)
    YorN()
def YorN():
    correctornot = input("Enter Y for yes if name is correct, enter N for no if name is not correct: ")
    if correctornot == "Y":
      print("You have your character's name!")
    elif correctornot == "N":
      print("Let's input the name again")
      choosingname()
    else:
      print("Invalid, neither Y or N was entered.")
      YorN()
choosingname(char_name)
print("CityBuilder: The Game. Is now running.")
sleep(1)
print("Hello %s, what's your city going to be called?" % char_name)
(Out of the code now: The code on the last line never prints the user's name why is that?)
Please help Huh
Reply


Messages In This Thread
Please help with code below! - by PyCoder - Jan-21-2018, 01:47 AM
RE: Please help with code below! - by PyCoder - Jan-21-2018, 05:19 AM
RE: Please help with code below! - by Mekire - Jan-21-2018, 06:14 AM
RE: Please help with code below! - by PyCoder - Jan-23-2018, 12:07 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020