+ 1
Int or floating
Pseudocode: While x(which is an input) is NOT equal to any numbers(floating numbers INCLUDED) between 1-10: Do this My attempt was: While not x == range(1,11) but it doesnt work
5 Answers
+ 4
Yes
+ 5
just to mention, that we can not use range() with float numbers, since range only generates integers:
print(3.14 in range(1,11))
result is: False
>> [Edited] : the following code enables you to use range():
inp = float(input())
if int(inp) in range(1,11):
print(inp,"is in range")
else:
print("out of range")
+ 2
not x in range()
+ 2
Can i write
While not 1 <= x <=10 ??
+ 2
You can do while 1<=x<=10:
print(True)