469,358 Members | 1,639 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,358 developers. It's quick & easy.

Get the bug out of "Debug"!

58
Can someone tell me what are the errors in my line of code?

I am new to Python and so you will have to try and ignore my noobishness, Sorry.
Expand|Select|Wrap|Line Numbers
  1. ################################################################################
  2. # Module:   Program Starter
  3. # Author:   Shing    
  4. # Date:     11/03/07
  5. # Version:  Draft 1.0
  6. '''
  7. This module provides a starter to all your Python Programs
  8. '''
  9. ################################################################################
  10. # Log:
  11. # 11/03/07   Shing - File created
  12. ################################################################################
  13. Area = Area.py
  14. SPR = SPR.py
  15. area = import Area.py
  16. spr = import SPR.py
  17. guess = raw_input("Program?")
  18. if guess == area:
  19.     import Area.py
  20.  
  21. elif guess == spr:
  22.         import SPR.py
  23.  

################################
# area = raw_input("Import area?") This is just some old stuff....
# spr = raw_input("Import spr?")
# if area : import Area.py
# else spr : import SPR.py
################################
Mar 12 '07 #1
3 1218
bvdet
2,851 Expert Mod 2GB
Can someone tell me what are the errors in my line of code?

I am new to Python and so you will have to try and ignore my noobishness, Sorry.

################################################## ##############################
# Module: Program Starter
# Author: Shing
# Date: 11/03/07
# Version: Draft 1.0
'''
This module provides a starter to all your Python Programs
'''
################################################## ##############################
# Log:
# 11/03/07 Shing - File created
################################################## ##############################
Area = Area.py
SPR = SPR.py
area = import Area.py
spr = import SPR.py
guess = raw_input("Program?")
if guess == area:
import Area.py

elif guess == spr:
import SPR.py



################################
# area = raw_input("Import area?") This is just some old stuff....
# spr = raw_input("Import spr?")
# if area : import Area.py
# else spr : import SPR.py
################################
Please use code tags when posting code. See 'REPLY GUIDELINES'. Try something like this:
Expand|Select|Wrap|Line Numbers
  1. while True:
  2.     guess = raw_input("Program or X to exit?")
  3.     if guess.lower() == 'area':
  4.         import Area
  5.         .... do stuff ....
  6.     elif guess.lower() == 'spr'
  7.         import SPR
  8.         .... do stuff ....
  9.     elif guess.lower() == 'x':
  10.         break
  11.     else:
  12.         print 'Invalid entry'
Mar 12 '07 #2
shing
58
why do u use lower()?
Mar 14 '07 #3
bvdet
2,851 Expert Mod 2GB
why do u use lower()?
It not required. I usually convert to lower case so the user can type in caps or lowers.
Mar 14 '07 #4

Post your reply

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

Similar topics

5 posts views Thread by John Smith | last post: by
10 posts views Thread by John Smith | last post: by
2 posts views Thread by Axel Dahmen | last post: by
reply views Thread by Gianni Nitti | last post: by
2 posts views Thread by Jeremy S. | last post: by
3 posts views Thread by Whiplash | last post: by
1 post views Thread by Alexander Walker | last post: by
2 posts views Thread by Joe Stateson | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.