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
% 是余数得意思