Sythe.Org Forums     Register     FAQ     Members List     Calendar     Mark Forums Read    
 
Sythe.Org Forums  
   Runescape Gold

Sythe.org — A Virtual Goods Trading Hub

Make real cash! buying and selling in-game items.

We have a no-scam policy.

You can make thousands playing your favourite games here at Sythe.org.

Just sign up an account and follow the rules!


Take me to

Runescape Markets

Other Game Markets

Support Center

Register an Account

Close
Why am I getting this error? (python)
Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 11-04-2010, 05:07 AM
kmjt's Avatar
"In order to succeed, you must first be willing to fail."
kmjt Donor Sythe Verified User
 
Join Date: Aug 2009
Location: Canada
Posts: 8,569
St. Patrick's Day 2013 Heidy
Default Why am I getting this error? (python)

For this problem i'm working on I don't get why it's not working. This is what I get when I try to run the program:

Quote:
6 + 2 = 8
Continue? (yes/no): yes

Traceback (most recent call last):
File "/Users/loganpytyl/Documents/question3assignment3.py", line 47, in <module>
main()
File "/Users/loganpytyl/Documents/question3assignment3.py", line 27, in main
while proceed == yes:
NameError: global name 'yes' is not defined
When I enter yes to continue that is the error I get..


This is my code:

Code:
import random



def main():

    
        
    number1 = random.randint(1,10)
    number2 = random.randint(1,10)


    outcome = number1 + number2


    print number1, "+", number2, "=", outcome


    proceed = raw_input("Continue? (yes/no): ")


    while proceed == yes:
        proceed()
       
        



def proceed():
    
        number1 = random.randint(1,10)
        number2 = random.randint(1,10)


        outcome = number1 + number2

        print number1, "+", number2, "=", outcome
        


    
main()
Reply With Quote
  #2  
Old 11-04-2010, 09:57 AM
Guru
 
Join Date: Jun 2005
Location: Canada
Posts: 1,844
Default Re: Why am I getting this error? (python)

I don't know what programming language this is, but I'll say what I think the error means and maybe it will help in some way.

Code:
NameError: global name 'yes' is not defined
To me that sounds like it's treating yes as a variable, and it hasn't been defined but it's trying to access its value.
__________________

Reply With Quote
  #3  
Old 11-04-2010, 12:47 PM
kmjt's Avatar
"In order to succeed, you must first be willing to fail."
kmjt Donor Sythe Verified User
 
Join Date: Aug 2009
Location: Canada
Posts: 8,569
St. Patrick's Day 2013 Heidy
Default Re: Why am I getting this error? (python)

It's python.
Reply With Quote
  #4  
Old 12-10-2010, 03:59 PM
Aeropsia's Avatar
Member
 
Join Date: May 2010
Posts: 27
Default Re: Why am I getting this error? (python)

Try putting yes in quotation marks.
__________________
Vouches: http://sythe.org/showthread.php?p=7457550
Reply With Quote
Reply



Cheap RS Gold Store  Runescape Gold

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

All times are GMT +1. The time now is 07:44 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.6.1