-1
\$\begingroup\$

I have a few lines of code here for Python:

 # Asks for a name
def CC():
    print "..."
    tick.clock(3)
    print "Welcome...\
    What is your name, scared one?"
    name = str(raw_input("What is your name?").lower())
    # For debugging purposes 
    print name

I want to run the code and ask the player what their name is with the line:

  name = str(raw_input("What is your name?").lower())

But every debugger I use online doesn't ask me for my name so i can only assume the code itself is wrong. I'm using Atom on Windows and i cant seem to find any useful run/debugging tools on there. Please send feedback on what it is I'm doing wrong in order to get the name of my character.This is to help in the development of a game I am currently working on.

Also I would appreciate it if you could tell me if there is a useful tool in Atom or online just for my sort of problem.

(P.S) I'm open to what I could do better. Thank you.

\$\endgroup\$
5
  • \$\begingroup\$ "every debugger I use online" - what have you tried? I'm guessing you mean sites like ideone? I don't think many of those actually allow input. Why aren't you running your program on your own computer? \$\endgroup\$ Commented Jan 19, 2016 at 8:34
  • \$\begingroup\$ Sorry, I am relatively new to coding and I had no idea I could do that... Would you please elaborate? \$\endgroup\$
    – Dezmen
    Commented Jan 19, 2016 at 10:36
  • \$\begingroup\$ Install Python, and set it to open .py files with python.exe (which it might do automatically, I'm not sure), assuming you're using Windows. The Windows version of Python also comes with IDLE, which probably does the same things as whichever website you're using (so you could use it instead). \$\endgroup\$ Commented Jan 19, 2016 at 20:10
  • 1
    \$\begingroup\$ In reference to the recent edit: please note that just because a problem comes up during game development, does not necessarily make it a game development problem. (This is a lesson I had to learn when I first started using this site too) The question you're asking here is a straight-up Python programming question, and doesn't rely on game-specific expertise, so StackOverflow is a better place to go for help. \$\endgroup\$
    – DMGregory
    Commented Jan 20, 2016 at 0:27
  • \$\begingroup\$ Thank you @DMGregory for explaining this to me...I had no idea \$\endgroup\$
    – Dezmen
    Commented Jan 20, 2016 at 0:43

1 Answer 1

0
\$\begingroup\$

I am not an expert on python either, but for some reason tick.clock(3) gives problems.

I also removed str() as it is useless. (Cleaner code is always better)

Try without that line:

# Asks for a name
def CC():
    print "..."
    print "Welcome...\
    What is your name, scared one?"
    name = raw_input("What is your name?").lower()
    # For debugging purposes 
    print name

(Tested on Python 2.7, works). More exactly, Here (PythonTutor, The first debugger I found).

Answer:

# Asks for a gender ( Title )
def CC():
print "..."
print "Welcome...\
What is your gender, scared one?"
name = str(raw_input("What is your gender?").lower())
if name == "boy" :
    name = "Scared boy..."
    print name
elif name == "girl":
    name = "Scared girl..."
    print name
else:
    print "Are you a boy or a girl?"
    return CC()
# Initiates CC formula
CC()
\$\endgroup\$
2
  • \$\begingroup\$ Since my post has been put on hold I cannot answer so i will post my answer as a comment. I removed some useless code and ended up looking back on my resources. Turns out i never called 'CC' and so it was confused. here is a fixed version. Also, i removed the name and changed it to gender seeing as it would be less complicated... \$\endgroup\$
    – Dezmen
    Commented Jan 19, 2016 at 22:41
  • \$\begingroup\$ code in comments brings ugly format... I'll try some other way. \$\endgroup\$
    – Dezmen
    Commented Jan 19, 2016 at 22:42

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.