Help With Python 3 Program.....

B

blackneos940

Guest
So this beta of a Program I've been working on, a text-based RPG, A Cold Day in Hell, seems to not run at ALL..... :( It only runs when I remove the function line..... (And of course, un-indent the following lines..... :))


Code:
def begin():

    #We get the name of the Main Character here

    name = input("Type the name of your character here: ")

    confirmation = input  ("Ah, so your name is", name, "is that right?\n>>> (Y/N)")

    if confirmation == "Y" or confirmation == "y":

        print ("Okay. Type the name of your home town:\n>>>  ")

    elif confirmation == "N" or confirmation == "n":

        print ("Re-enter the name of your character.")

        begin(start)

Why does it end before it begins.....? :( I put a "print" test BEFORE the function, and it ran fine..... Hmmmmm..... Anyway, thank you for the help..... :D Oh yeah..... What's your favorite thing to eat for Thanksgiving.....? :)
 


I beleive you have to many arguments for the input() function. You may want to try something like this:
Code:
def begin():

    name = input("Type the name of your character here: ")
    print("Ah your name is: " + name)
    confirmation = input("is that right?\n>>> (Y/N)").capitalize()

    if confirmation == "Y":

        print("Okay. Type the name of your home town:\n>>>  ")

    elif confirmation == "N":

        print("Re-enter the name of your character.")

*Note .capatilize() is being used to shorten the code slightly. I am not sure about the begin(start) call though. Have you tried Pycharm 4? It is pretty cool.

Stuffing of course. ;)
 
Last edited:
I beleive you have to many arguments for the input() function. You may want to try something like this:
Code:
def begin():

    name = input("Type the name of your character here: ")
    print("Ah your name is: " + name)
    confirmation = input("is that right?\n>>> (Y/N)").capitalize()

    if confirmation == "Y":

        print("Okay. Type the name of your home town:\n>>>  ")

    elif confirmation == "N":

        print("Re-enter the name of your character.")

*Note .capatilize() is being used to shorten the code slightly. I am not sure about the begin(start) call though. Have you tried Pycharm 4? It is pretty cool.

Stuffing of course. ;)


Thank you for the help..... : ) I copied and pasted it into Nano, and CTRL X'd it, saving it, and..... When I ran it, it still showed nothing..... :( Also, the reason why I called the first function again was because if the Player made a mistake, and typed in "Tofu" "Or Windows Rulez, I am 733t COD H4x0r", or anything ELSE, as their answer, instead of "Y" or "N", they wouldn't have to type Python / Python2/ Python3 to get it back up again..... :) But I like the idea of using Capitalize..... :D I'm also learning C now...... :) Sigh, the road to becoming a Hacker, let alone a good PROGRAMMER, is a long and arduous one..... :(
 
Thank you for the help..... : ) I copied and pasted it into Nano, and CTRL X'd it, saving it, and..... When I ran it, it still showed nothing..... :( Also, the reason why I called the first function again was because if the Player made a mistake, and typed in "Tofu" "Or Windows Rulez, I am 733t COD H4x0r", or anything ELSE, as their answer, instead of "Y" or "N", they wouldn't have to type Python / Python2/ Python3 to get it back up again..... :) But I like the idea of using Capitalize..... :D I'm also learning C now...... :) Sigh, the road to becoming a Hacker, let alone a good PROGRAMMER, is a long and arduous one..... :(


But I won't give in..... :D And though you're miles ahead of me in skill, I'm still here for you too, buddy..... :D Penguin Army, UNITE!!..... :)
 
Thank you for the help..... : ) I copied and pasted it into Nano, and CTRL X'd it, saving it, and..... When I ran it, it still showed nothing..... :( Also, the reason why I called the first function again was because if the Player made a mistake, and typed in "Tofu" "Or Windows Rulez, I am 733t COD H4x0r", or anything ELSE, as their answer, instead of "Y" or "N", they wouldn't have to type Python / Python2/ Python3 to get it back up again..... :) But I like the idea of using Capitalize..... :D I'm also learning C now...... :) Sigh, the road to becoming a Hacker, let alone a good PROGRAMMER, is a long and arduous one..... :(
You should use a while or do-while loop then. While the input is not Y or N...
 
You should use a while or do-while loop then. While the input is not Y or N...
It works!..... : D It works!..... : D *Showers you with hugs*...... :3

Thanks!!..... :D Hey, when I finish the game, wanna be the first to play it.....? :)
 

Members online


Top