473,320 Members | 2,012 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Help on simple input output thing in python.

Ok, so what I need to is just have it simply print out if the number is between 7 or 13 to print out whats in the quotes... I'm stuck at this point and I can't figure it out cause it won't print anything out. PLEASE HELP :)

Expand|Select|Wrap|Line Numbers
  1. if num_correct < 7 or > 13:
  2.     print 'You got a check in the lab.'
  3. elif num_correct < 3 or > 6:
  4.     print 'You got a minus in the lab.'
  5. elif num_correct < 0 or > 2:
  6.     print 'You got a zero in the lab.'
  7.  
  8. #This is to show the values in the range.
  9. if num_correct == "14":
  10.     print 'You got a plus for the lab.'
  11. elif num_correct == "7" or num_correct == "8" or\
  12. num_correct == "9" or num_correct == "10" or\
  13. num_correct == "11" or num_correct == "12" or\
  14. num_correct == "13":
  15.     print 'You got a check for the lab.'
  16. elif num_correct == "3" or num_correct == "4" or\
  17. num_correct == "5" or num_correct == "6":
  18.     print 'You got a minus for the lab.'
  19. elif num_correct == "0" or num_correct == "1":
  20.     print 'You got a zero for the lab.'
Oct 21 '10 #1
2 1443
dwblas
626 Expert 512MB
Note the difference between these two statements
Expand|Select|Wrap|Line Numbers
  1. if num_correct < 7 or > 13:
  2. elif num_correct == "7" or num_correct == "8" 
An "or" statement is simply an if() + elif()
Expand|Select|Wrap|Line Numbers
  1. if num_correct == "7" or num_correct == "8":
  2.    print "num_correct"
  3. #
  4. # can be expressed as
  5. if num_correct == "7":
  6.     print "num_correct"
  7. elif num_correct == "8":
  8.     print "num_correct" 
so the code you posted breaks down into
Expand|Select|Wrap|Line Numbers
  1. if num_correct < 7 or > 13:
  2. #
  3. # can also be expressed by
  4. if num_correct < 7:
  5.     print "#1 num_correct:
  6. elif > 13:
  7.     print "#2 num_correct"
  8.  
Oct 21 '10 #2
Ok thank you so much... I also talked to my teacher about it and he pretty much said the same thing. thanks for you help.
Oct 21 '10 #3

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

Similar topics

3
by: Bill Cohagan | last post by:
I'm writing a console app (in C#) and I want to be able to redirect the standard input/output streams when it's run at a command prompt. IOW I want to support the "<" and ">" redirection syntax....
3
by: qbschmidt | last post by:
i can input and output to a text file as long as the file is in the same directory as my c++ program. but i cant figure out how to input/output to a file in another directory i.e. I:\c++projects...
2
by: qazmlp1209 | last post by:
FAQ at "http://www.parashift.com/c++-faq-lite/input-output.html#faq-15.6" states that the following program will not work properly: --------------- int main() { char name; int age; for (;;)
3
by: ES Kim | last post by:
Hi, I am using VC++ .NET 7.0. I'd like to debug my console program, using redirection of input/output for convenience. Help menu tells me it's possible to specify a file name as a command-line...
4
by: Jerry LeVan | last post by:
Hi, I am adding image and large object support in my Cocoa postgresql browser. Are there going to be any enhanced bytea support functions coming along? It seems sorta silly to have to write...
2
by: Key9 | last post by:
Question about basic input output. HI All I am a new C++er Suppose I am designing a i/o device . system have screens . system have keyboards.
4
by: lenin42001 | last post by:
Can someone be off assistance? We're trying to input/output some patients data in a hypothetical form. The records display sequentially & can be retrieved from a data store................This must...
3
by: John Williams | last post by:
I'm writing a stagenography program to experiment with how it works. The algorithm I'm using appears to be producing the correct result...however I'm struggling with the file input. I never...
3
by: Rainy | last post by:
Hello! I'm having some trouble with pyserial package, I'm sending commands and reading responses from a custom pcb, and sometimes I get a proper response, at other times I get nothing, and...
2
by: wizche | last post by:
Hi, I'm currently trying to develop a IR Remote (TV consumer) listener in C under Linux. First of all I tried with an old notebook with an integrated IR peripheral (FIR)under Debian (kernel...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.