![]() |
|
![]() |
| 變數: Variable |
||
| 輸入句子: Input statement |
||
| 得分: score |
||
int / float
#-----
while True:
try:
x = int(input('enter month(1-12): '))
if x>=1 and x<=12: break
except:
print('Type Error')
print(x)
#-----
while True:
num = input('Enter a number: ') # str
print(num, type(num), len(num))
try:
n = int(num)
print('n =', n, type(n))
except:
print('error')
print()