I have some code I messing around with.. Very new to python and coding in general, however I stumped on this one.
I defined a function, and got some user input from that. When I try to print the input, I get a NameError: name 'my_name' is not defined.
Here is the code..
#New Program
#Written by Chris Nelson of Cnelson Creations
#This code obtains some basic information from the user
def questions():
if userinput == "Y":
my_name = input("What is your name? ")`enter code here`
my_age = input("What is your age? ")
my_urname = input("Please pick a username.. ")
my_psword = input("Please pick a password.. ")
elif userinput == "N":
print ("Sorry we need the information to continue..")
print ("... Goodbye")
exit()
else:
print ("Not a valid choice.. Goodbye!")
exit()
print ("We need to obtain some information from you before going forward")
print ("Is this ok? Enter Y for 'yes' or N for 'No'...")
userinput = input("Please enter Y or N ")
questions() #This code runs the function listed above..
print ("Great we have some information from you!")
print ("Lets confirm it is the correct information.. ")
print ('{}, {}, {}, {}, is this information correct?'.format(my_name, my_age, my_urname, my_psword))