20180202

Python - Test Codes

Python - Test Codes

Keywords: Python, Test, Code, ... .
____________________________________________________________

#Import math package, then calculate sin 90 degree.
>>> import math
>>> print(math.sin(math.pi/2))
1.0
____________________________________________________________

#定義 x 與 y,再顯示 x與y值。

>>>x,y = 2,3
>>>print (x,y)
2,3
____________________________________________________________

#輸入年齡以判斷差幾歲可以投票

>>>print ('Please input your age.')
>>>age = int (input('age='))
>>>if age >=20:
>>> print ("please goto vote")
>>>else:
diff = 20 - age
>>>print ('You need {} years to vote.'.format(diff))

____________________________________________________________

沒有留言: