Python : ex2

print("I will now count my chickens:")
print("Hens",25 + 10 / 2)
print("Roosters",100 - 25 * 2 % 4)
print("Now I will count the eggs:")
print(3 + 2 - 5 % 2 - 1 / 4)
print("Is it true that 3 + 2 >5 -1?")
print(3 + 2 > 5 - 1)
print("What is 3+2? " , 3+2)
print("that is 5-7?",5-7)
print("oh,that's why it's False.")
print("Is it greater?",5>-2)
print("Is it greater or equal?",5>=-2)
print("Is it less or equal?" ,5<=-2)
print("this is float",10.2 * 2.5 + 10.5)
print("what is %?" ,10.0 % 3)
print("what is %?" ,5.0 % 3)
print("what is %?" ,15.0 % 6)
print("% 是余数得意思")

运行结果:

PS C:\Users\even> Python .\lpthw\ex2.py
I will now count my chickens:
Hens 30.0
Roosters 98
Now I will count the eggs:
3.75
Is it true that 3 + 2 >5 -1?
True
What is 3+2?  5
that is 5-7? -2
oh,that's why it's False.
Is it greater? True
Is it greater or equal? True
Is it less or equal? False
this is float 36.0
what is %? 1.0
what is %? 2.0
what is %? 3.0
% 是余数得意思

原文发布于微信公众号 - 项勇(xiangy_life)

原文发表时间:2018-11-27

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

发表于

我来说两句

0 条评论
登录 后参与评论

扫码关注云+社区

领取腾讯云代金券