[Tutor] Help

Brandon btiqui at gmail.com
Sat Feb 2 03:01:15 CET 2013


You get the error because you call path1pt1() before it is defined.  Define
your path1pt1() method at the top of your code before simpstart().

Brandon

On Fri, Feb 1, 2013 at 5:47 PM, Jack Little <jacklittlemc at yahoo.com> wrote:

> I get this error
>
> Traceback (most recent call last):
>   File "C:\Users\Jack\Desktop\python\g.py", line 56, in <module>
>     path1pt1()
> NameError: name 'path1pt1' is not defined
>
> With this amount of code:
>
>
> def simpstart():
>   global ammo1
>   global ammo2
>   global ammo3
>   global health
>   global tech_parts
>   global exp
>   global radio_parts
>   ammo1=10
>   ammo2=0
>   ammo3=0
>   health=100
>   tech_parts=0
>   exp=0
>   radio_parts=0
> print "You awake in a haze. A crate,a door and a radio."
> g1 = raw_input("Which do you choose  ")
> if g1 == "CRATE" or g1 == "Crate" or g1 == "crate":
>         print "There is a pack of ammo,some food and an odd microchip"
>         ammo1=ammo1 + 6
>         health=health + 10
>         tech_parts=tech_parts + 1
> elif g1 =="DOOR" or g1 == "Door" or g1 == "door":
>       print "You are outside"
> elif g1 == "RADIO" or g1 == "Radio" or g1 == "radio":
>       print "It's only a few parts"
>       radio_parts=radio_parts+3
> g2 = raw_input("So this is NYC.Ten years after.There are a few streets.Go
> west or north  ")
> if g2 == "WEST" or g2 == "West" or g2 == "west":
>       path2_pt1()
> elif g2 == "NORTH" or g2 == "North" or g2 == "north":
>       path1pt1()
>
>
> def path1pt1():
>     print "This is where it all started. Freedom Tower. A biotech firm
> called Aesthos Biotechnology. Based here."
>     print "I worked there."
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20130201/baa5fe8a/attachment.html>


More information about the Tutor mailing list