Checking if multiple user-entered numbers are in the right range str, ski = int(input("text here")), int(input("text here"))

    if str &lt; 1 or str &gt; 50 or ski &lt; 1 or ski &gt; 50:
        print("did not enter between 1 and 50")


Is there anyway to shorten the if statement in that code? I find that it is a bit too long, but I don't really know how to shorten it.

Any suggestions?
This snippet is not very useful. You should not let the user continue after giving you wrong input; rather, as soon as an incorrect number is entered, you should figure out what to do next.
(As you have not included any context in your question, this is left as an exercise to you).
Your names are extremely poor:
str is a library function and should therefore never be used as a variable name.
str and ski are useless as they do not reveal what the variables are about.
Be expressive.
You are repeating yourself on a small scale: you are writing int(input(...)) twice and the two portions of the if statement follow the same logic. Get rid of the duplication.


Consider these improvements applied to your code:


Use list comprehensions and generator expressions to your advantage
Use the all(...) function with a generator expresssion to verify that all answers are in the specified range




prompts = ('text here', 'text here')
answers = [int(input(p)) for p in prompts]
if not all(0 &lt; a &lt;= 50 for a in answers):
    print('did not enter between 1 and 50')

# if you need to access the answers individually, use
first, second = answers