python exercise

need help to run the python program

Page 1 of 1

5 Replies - 2148 Views - Last Post: 08 January 2009 - 06:57 PM Rate Topic: -----

#1 neekee711  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 06-January 09

python exercise

Posted 06 January 2009 - 07:22 PM

Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.

	****************************************************************
	Personal firewall software may warn about the connection IDLE
	makes to its subprocess using this computer's internal loopback
	interface.  This connection is not visible on any external
	interface and no data is sent to or received from the Internet.
	****************************************************************
	
IDLE 1.2.2	  
>>> ================================ RESTART ================================
>>> 
Enter wins year1
Enter wins year2
Enter wins year3
Enter wins year4
Enter wins year5

Traceback (most recent call last):
  File "C:/Python25/python 1.5", line 6, in <module>
	averageWins=(year1+year2+year3+year4+year5)/5
NameError: name 'year1' is not defined
>>> 
 
Please give me help

Is This A Good Question/Topic? 0
  • +

Replies To: python exercise

#2 BetaWar  Icon User is offline

  • #include "soul.h"
  • member icon

Reputation: 1199
  • View blog
  • Posts: 7,306
  • Joined: 07-September 06

Re: python exercise

Posted 06 January 2009 - 08:02 PM

Well, we will need to see source code to be positive, but it looks like you have the problem that you aren't actually asking for input, just acting like it.

Please post your code like so:
:code:
Was This Post Helpful? 1
  • +
  • -

#3 neekee711  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 06-January 09

Re: python exercise

Posted 06 January 2009 - 08:58 PM

Thank you so much. You were right.I was missing the input

View Postneekee711, on 6 Jan, 2009 - 06:22 PM, said:

Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.

	****************************************************************
	Personal firewall software may warn about the connection IDLE
	makes to its subprocess using this computer's internal loopback
	interface.  This connection is not visible on any external
	interface and no data is sent to or received from the Internet.
	****************************************************************
	
IDLE 1.2.2	  
>>> ================================ RESTART ================================
>>> 
Enter wins year1
Enter wins year2
Enter wins year3
Enter wins year4
Enter wins year5

Traceback (most recent call last):
  File "C:/Python25/python 1.5", line 6, in <module>
	averageWins=(year1+year2+year3+year4+year5)/5
NameError: name 'year1' is not defined
>>> 
 
Please give me help

Was This Post Helpful? 0
  • +
  • -

#4 BetaWar  Icon User is offline

  • #include "soul.h"
  • member icon

Reputation: 1199
  • View blog
  • Posts: 7,306
  • Joined: 07-September 06

Re: python exercise

Posted 06 January 2009 - 09:04 PM

LOL, no problem.

At DIC we be code psychics, with the occassional ninja thrown in. :ph34r:
Was This Post Helpful? 0
  • +
  • -

#5 vieirabear  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 26-December 08

Re: python exercise

Posted 07 January 2009 - 09:25 PM

View Postneekee711, on 6 Jan, 2009 - 06:22 PM, said:

Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.

	****************************************************************
	Personal firewall software may warn about the connection IDLE
	makes to its subprocess using this computer's internal loopback
	interface.  This connection is not visible on any external
	interface and no data is sent to or received from the Internet.
	****************************************************************
	
IDLE 1.2.2	  
>>> ================================ RESTART ================================
>>> 
Enter wins year1
Enter wins year2
Enter wins year3
Enter wins year4
Enter wins year5

Traceback (most recent call last):
  File "C:/Python25/python 1.5", line 6, in <module>
	averageWins=(year1+year2+year3+year4+year5)/5
NameError: name 'year1' is not defined
>>> 
 
Please give me help

Was This Post Helpful? 0
  • +
  • -

#6 atik97  Icon User is offline

  • ???
  • member icon

Reputation: 144
  • View blog
  • Posts: 715
  • Joined: 16-September 08

Re: python exercise

Posted 08 January 2009 - 06:57 PM

What are you trying to do? If you want to take input from user, then try
year1=raw_input("Win:")
year2=raw_input("Win:")


...and so on.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1