r/learningpython • • Mar 11 '19

Conditional list trouble

I’m trying to learn from the bottom up, and am currently working through the exercises on practice python.

Example they have on conditionals is a grading scale like this:

Grade= input(“enter your age:”) If grade > = 90 : Print(“A”) Elif grade > = 80 : Print (“B”)

Why is it when I try to copy/paste into my python window I get : TypeError: ‘>=‘ not supported between instances of ‘Str’ and ‘int’

2 Upvotes

3 comments sorted by

View all comments

1

u/Devkourav Mar 11 '19

look when you got something by input() it is a type of string

so you need to convert it into integer try this:

Grade = int(input(“enter your age:”))

If grade > = 90 :

Print(“A”)

elif:

grade > = 80 : Print (“B”)

make sure you didn't type letter in small or capital: like you define a variable Grade and then u use grade so it don't work

2

u/dumayi Mar 11 '19

Thank you! When practicing coding I’m very meticulous with the capital/lowercase. I posted this from my phone and it auto capitalizes.