I'm taking an intro to programming course using python. I'm trying to make an integer output to a letter grade. I've been trying forever, help.
I'm taking an intro to programming course using python. I'm trying to make an integer output to a letter grade...
Other urls found in this thread:
Try adding range before the ranges so it is range(27,30)
why don't you run it and see if it works? if ti doesn't work, post the error.
Or try if score < 17 and score > 0... Etc.
It just prints the else statement no matter what
ill try
does the same thing with the else statement
try 24
Try this
( score-for-op in range (1,17) ) == true
24
Yeah, if score in range(1,17) for F
syntax error
If you're doing that then you'll need to do it like if score > 0 and score < 17 you have to include both mentions of score
got it guys thanks. I was forgetting "in" when using range
Nice.
thx guys
use an IDE, that'll help...
VSCode is pretty good for scripting languages
I'll remember that for next time
fyi user, in such cases using if's will probably be more efficient (if x >= 10 and x
In this specific assignment, the teacher wanted us to use elif, otherwise I would've used if. im more comfortable with it
got it. anyway it's definitely good practice, good luck!
also this could be shorter
if X
Remember to use validation when you ask a user to input stuff.
trinket.io
programmer user here: you have to think this through.
An A grade is from 100 to 90. So if your program gets a number greater than or equal to 90 it should return 'A'.
follow suit for all of the letter grades.
it would be more "pythonic" to use range() but you're still learning the fundamentals. just get the job done the best way you can.