I don't know how to prove that the value of my numbers are between 0 and 10... Can someone help me?
Asked
Active
Viewed 70 times
-1

codester_09
- 5,622
- 2
- 5
- 27

Oliver
- 1
- 1
-
1Welcome to SO! Please do not post picture of your code. Instead, please type it into your post. Thank you – Sep 25 '22 at 12:00
2 Answers
1
Try this:
def check_number(number):
if (number > 0) and (number < 10):
return True
return False
or to also include 0 and 10:
def check_number(number):
if (number >= 0) and (number <= 10):
return True
return False

Damiaan
- 777
- 4
- 11
1
Try this
if all(0 <= a <= 10 for a in [selected_number1, selected_number2, selected_number3, selected_number4]:
print('')
player_number()
For the second function
if all(0 <= a <= 10 for a in [player_number1, player_number2, player_number3, player_number4]:
print('')
check_number()
If you want to exclude 0 and 10 then replace <=
with <
.

codester_09
- 5,622
- 2
- 5
- 27