Somehow, your message didn't appear here for 9 days. That's probably why you haven't seen any responses yet.

On 05/06/2013 01:26 AM, subha krishna wrote:
hi,

   i need an help in the following program

i just started to learn.

if speed >= 80:
print 'License and registration please'

Indentation is lost here and elsewhere in the program. That's probably because your email program is mistakenly set to send html messages. Please use text mail on this forum. Losing indentation is just one of the problems triggered by html, but it's very important in python.

if mood == 'terrible' or speed >= 100:
print 'You have the right to remain silent.'
elif mood == 'bad' or speed >= 90:
print "I'm going to have to write you a ticket."
write_ticket()
else:
print "Let's try to keep it under 80 ok?"

in this prgm how to give  the value of speed  and mood.

i have written like this to get the value

def main():
     print 'enter the speed and mood'
     print 'enter the speed',speed
     if speed >= 80:
         print 'License and registration please'
     print 'enter the mood',mood
     if mood== 'terrible' or speed >=100
         print 'you hve the right to remain silent.'
     elif mood =='bad' or speed >=90:
         print "I 'm going to have to write you a ticket."
         write_ticket()
     else:
         print "Let's try to keep it under 80 ok?"

i am getting  error in this line (if mood== 'terrible' or speed >=100)

When you show an error, you should give the complete traceback. in this case, it didn't matter, however.

An if statement must end with a colon.


kindly give me an idea about the mistake and how to get the values...


You would use the raw_input() statement. print() doesn't wait for any keystrokes from the user, it just displays things.

Note that the return value of raw_input() is a string, so in the case of speed, you'll need to convert it to an int or float.


--
DaveA
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to