473,395 Members | 1,458 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

What is wrong with this code?

I just started learning Python... 11 hours ago... And I tried to make an old-school dungeon game. So I made this program, but I get errors when I try to run it. I think its worth mentioning that I wrote the program while using Python 3.1 but I just changed to 2.6 because it seems to be used more.

Expand|Select|Wrap|Line Numbers
  1. print("Welcome to Boyyini's first program. \n This is my first attempt at making a program from scratch.")
  2. print("In this program I will be taking you through a text-based mini-adventure.")
  3. input("Press the enter key to continue.")
  4. print("First, I will ask you your name.")
  5. name = input("Please enter your name")
  6. print("Hello,", name,"What a nice name.")
  7. input("Press the enter key to continue.")
  8. gender = input("Are you a guy or girl?")
  9. print("Your a ", gender, "? Okay, that's cool.")
  10. age = input("How old are you?")
  11. print("Okay, I guess ",age, "is old enough to go...")
  12. print("Last question, do you have extensive liability insurence?")
  13. input("Ha ha ha, just kidding! ... Press Enter to start your adventure!")
  14. print("\n\nOkay! Now your at the entrance of the cave!")
  15. a = input("Do you want to Run In or Walk In?")
  16. if a == 'Run In':
  17.     print("You burn a few calories.")
  18. if a == 'Walk In':
  19.     print("You slowly walk in.")
  20. print("You survived the cave!")
  21. input("\n\nPress the enter key to exit.")
The error I get is...
Expand|Select|Wrap|Line Numbers
  1. Traceback (most recent call last):
  2.   File "C:\Documents and Settings\Boyyini\Desktop\Test1.py", line 3, in <module>
  3.     input("Press the enter key to continue.")
  4.   File "<string>", line 0
  5.  
  6.    ^
  7. SyntaxError: unexpected EOF while parsing
How do I solve this? And are there any other things I should change?
Apr 10 '10 #1
5 1697
bvdet
2,851 Expert Mod 2GB
Substitute raw_input() for input() function calls.
Apr 10 '10 #2
I looked at your code. Have a look at the changes and tell me what you think
I added time delays and just made it generally friendlier to the user!!
Expand|Select|Wrap|Line Numbers
  1. import time
  2. print("Welcome to Boyyini's first program. \n This is my first attempt at making a program from scratch.")
  3. time.sleep(2)
  4. print("In this program I will be taking you through a text-based mini-adventure.")
  5. time.sleep(2)
  6. print("Press the enter key to continue.")
  7. A = ""
  8. if A == "":
  9.     print("First, I will ask you your name.")
  10.     name = raw_input("Please enter your name"" ")
  11. print "Hello,", name,"What a nice name."
  12. if A == "":
  13.     time.sleep(1)
  14.     print "Press the enter key to continue."
  15. gender = raw_input("Are you a guy or girl?"" ")
  16. print "Your a ", gender, "? Okay, that's cool."
  17. time.sleep(1)
  18. age = raw_input("How old are you?"" ")
  19. print "Okay, I guess ",age, "is old enough to go..."
  20. time.sleep(1)
  21. print("Last question, do you have extensive liability insurence?")
  22. time.sleep(2)
  23. print("Ha ha ha, just kidding! ... Press Enter to start your adventure!")
  24. B = raw_input()
  25. if B == "":
  26.     print("\n\nOkay! Now your at the entrance of the cave!")
  27. a = raw_input("Do you want to Run In or Walk In?"" ")
  28. if a == 'Run In':
  29.     print("You burn a few calories.")
  30. if a == 'Walk In':
  31.     print("You slowly walk in.")
  32. time.sleep(1)
  33. print("You survived the cave!")
  34. time.sleep(1)
  35. print("\n\nPress the enter key to exit.")
  36. B = raw_input()
  37. if B == "":
  38.     print " Come Again soon!!"
Apr 10 '10 #3
bvdet
2,851 Expert Mod 2GB
Avatar19,

Please use code tags when posting code. See posting guidelines here.

BV - Moderator
Apr 10 '10 #4
Apologies, will be more careful next time.
Thanks!!
Apr 10 '10 #5
Thanks for the help guys.
Apr 10 '10 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

125
by: Sarah Tanembaum | last post by:
Beside its an opensource and supported by community, what's the fundamental differences between PostgreSQL and those high-price commercial database (and some are bloated such as Oracle) from...
72
by: E. Robert Tisdale | last post by:
What makes a good C/C++ programmer? Would you be surprised if I told you that it has almost nothing to do with your knowledge of C or C++? There isn't much difference in productivity, for...
121
by: typingcat | last post by:
First of all, I'm an Asian and I need to input Japanese, Korean and so on. I've tried many PHP IDEs today, but almost non of them supported Unicode (UTF-8) file. I've found that the only Unicode...
51
by: WindAndWaves | last post by:
Can anyone tell me what is wrong with the goto command. I noticed it is one of those NEVER USE. I can understand that it may lead to confusing code, but I often use it like this: is this...
46
by: Keith K | last post by:
Having developed with VB since 1992, I am now VERY interested in C#. I've written several applications with C# and I do enjoy the language. What C# Needs: There are a few things that I do...
13
by: Jason Huang | last post by:
Hi, Would someone explain the following coding more detail for me? What's the ( ) for? CurrentText = (TextBox)e.Item.Cells.Controls; Thanks. Jason
1
by: GS | last post by:
I got a combobox box that I load at load time. the Item and vales ended up in reverse order of each other, what went wrong? the database table has the following row code value ebay ...
98
by: tjb | last post by:
I often see code like this: /// <summary> /// Removes a node. /// </summary> /// <param name="node">The node to remove.</param> public void RemoveNode(Node node) { <...> }
9
by: Pyenos | last post by:
import cPickle, shelve could someone tell me what things are wrong with my code? class progress: PROGRESS_TABLE_ACTIONS= DEFAULT_PROGRESS_DATA_FILE="progress_data" PROGRESS_OUTCOMES=
20
by: Daniel.C | last post by:
Hello. I just copied this code from my book with no modification : #include <stdio.h> /* count characters in input; 1st version */ main() { long nc; nc = 0;
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.