Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (47.6k points)
recategorized by

How would you write, in python:

if key < 1 or key > 34:

I've tried every way I can think of, and am finding it very frustrating.

1 Answer

0 votes
by (106k points)

The if keyword is not an int or float value but it is a string, you need to convert it to an int first by following ways:-

key = int(key)

or to a float by doing

key = float(key)

Related questions

0 votes
1 answer
0 votes
2 answers
0 votes
1 answer

Browse Categories

...