Lost Password?


Go Back   CodeCall Programming Forum > Software Development > Python

Python Discussion forum for Python, a high-level language with simple syntax, but yet powerful.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-18-2007, 12:59 PM
Timotay Timotay is offline
Newbie
 
Join Date: Oct 2007
Location: England
Posts: 6
Rep Power: 0
Timotay is on a distinguished road
Default the noob i am!

ok this is my code;
a = input ("enter first number")
print a
b = input ("entre secound number")
print "addition", a+b
print "multiply", a*b
print ("close?")
text = raw_input ()
if text == "yes":
exit ()
if text == "no":

now at the end i want to loop back to the start if "no" is entered, but i can't seem to get it.
any advise?
many thanks!
Tim
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 10-18-2007, 01:06 PM
v0id's Avatar   
v0id v0id is offline
Retired
 
Join Date: Apr 2007
Location: Denmark
Posts: 2,654
Last Blog:
CherryPy(thon)
Rep Power: 29
v0id is a glorious beacon of lightv0id is a glorious beacon of lightv0id is a glorious beacon of lightv0id is a glorious beacon of lightv0id is a glorious beacon of lightv0id is a glorious beacon of light
Send a message via MSN to v0id
Default

This will help you on the way...
Code:
choice = ""
while choice != "no":
    # This is the start
    print "Do you want to try again? Yes/No"
    # If the user writes "yes" then it goes back to "This is the start"
    # Otherwise, it will quit the loop
# and end here.
print "You decided not to try again, and ended the loop"
__________________
05-03-2007 - 11-13-2008
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 10-18-2007, 02:08 PM
Timotay Timotay is offline
Newbie
 
Join Date: Oct 2007
Location: England
Posts: 6
Rep Power: 0
Timotay is on a distinguished road
Default

thanks! i came up with this

choice = ""
while choice!= "no":
a = input ("enter first number")
print a
b = input ("enter secound number")
print b
print "addition", a+b
print "multiply", a*b

print ("retry?")
text = raw_input ()

if text == "yes":
exit ()

very nice! lol, just one question the first line what is the function of the two speach marks?? apart from that i get it!
thanks
Tim
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 10-19-2007, 04:01 AM
v0id's Avatar   
v0id v0id is offline
Retired
 
Join Date: Apr 2007
Location: Denmark
Posts: 2,654
Last Blog:
CherryPy(thon)
Rep Power: 29
v0id is a glorious beacon of lightv0id is a glorious beacon of lightv0id is a glorious beacon of lightv0id is a glorious beacon of lightv0id is a glorious beacon of lightv0id is a glorious beacon of light
Send a message via MSN to v0id
Default

Actually, you can remove that first line, it's not needed. The only thing is does, is to empty the string. I forgot that you don't have to pre-declare Python-variables when I wrote it. So you can simply leave it there or remove it.
__________________
05-03-2007 - 11-13-2008
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Well, look! A Noob! maddy1080 Introductions 2 09-28-2007 08:24 AM
Noob Questtion.... teckmonkey C and C++ 2 07-27-2007 11:51 PM
noob here.. help plz.. wenwang General Programming 2 05-15-2007 11:06 AM
web dev noob question jub jub jedi General Programming 1 03-26-2007 07:41 AM
Best Linux for a noob... PC101 General Programming 14 09-22-2006 10:21 AM


All times are GMT -5. The time now is 08:27 AM.

Contest Stats

WingedPanther ........ 2753.6
Xav ........ 2704
Brandon W ........ 1702.32
John ........ 1207.73
marwex89 ........ 1175.24
morefood2001 ........ 966.05
dcs ........ 655.75
Steve.L ........ 475.59
orjan ........ 418.58
Aereshaa ........ 383.54

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 100%


Complete - Celebrate!

Ads