1 n = input()
2 if n>=100:print(int(n)/10)
3 else:print(int(n)*10)
Error:
Traceback (most recent call last):
File "1.py", line 12, in <module>
if n>=100:print(int(n)/10)
TypeError: '>=' not supported between instances of 'str' and 'int'
***Repl Closed***
analysis: the data type returned by input() is STR, which cannot be directly compared with integers. You must first replace STR with integers, and use the int() method
therefore, the input variable can be converted to int
1 n = input()
2 n = int(n)
3 if n>=100:print(int(n)/10)
4 else:print(int(n)*10)
Or
1 n = int(input("Input a number:"))
2 if n>=100:print(int(n)/10)
3 else:print(int(n)*10)