We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,313 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

How do you go to different areas?

I am developing a text based rpg, but do not know how to go to different def statement, but it says it is not defined. Help?

3
Contributors
4
Replies
2 Weeks
Discussion Span
3 Months Ago
Last Updated
43
Views
Jacklittle01
Light Poster
25 posts since Aug 2012
Reputation Points: -3
Solved Threads: 0
Skill Endorsements: 0

Can you post your code ?

Gribouillis
Posting Maven
Moderator
3,101 posts since Jul 2008
Reputation Points: 1,130
Solved Threads: 761
Skill Endorsements: 11

uhhhh... on a different computer

Jacklittle01
Light Poster
25 posts since Aug 2012
Reputation Points: -3
Solved Threads: 0
Skill Endorsements: 0

uhhhh... on a different computer

No problem, we can wait.

do not know how to go to different def statement,

As in:

def printMenu():
    print('1: Option 1\n2: Option 2\n3: exit')
def menu():
    answer = ""
    while(1):
        printMenu()
        answer = input("Choose: ")
        if (answer == "1"):
            #do stuff
            print("option 1")
        elif (answer=="2"):
            #do stuff for answer 2
            print("option 2")
        elif (answer=="3"): break
        else: print('Invalid command')

menu()
Lucaci Andrew
Practically a Master Poster
649 posts since Jan 2012
Reputation Points: 91
Solved Threads: 91
Skill Endorsements: 12

yes

Jacklittle01
Light Poster
25 posts since Aug 2012
Reputation Points: -3
Solved Threads: 0
Skill Endorsements: 0

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page rendered in 0.0740 seconds using 2.7MB