>>> 3+0.5
|
>>>9**0.5
|
>>>123%10
|
>>> 10/2
|
>>>55//3
|
>>>(65-23)*2/3
|
>>>n=987 >>> format(n,'.1f')
|
>>> n=987 >>> float(n)
|
>>> n=1254.9 >>> int(n)
|
>>>print( format(n,'.1f'))
|
>>> n=“987” >>> float(n)
|
>>> n=“1254.9” >>> int(n)
|
i = 1 #定义记录循环次数的变量
sum= 0 #定义结果变量,存放总和
while i <= 100:
i=i+1 #处理计数器
print(“1~ 100之间的数字之和为:”, sum) #输出结果