Python has four types of numbers:
1. Integral type
2. Long Integer type
3. Floating point number
4. Complex complex numbers are the generalization of real numbers, which make any polynomial have roots. In the plural there is a "imaginary unit" J, which is a square root of 1. Any complex number can be expressed as X+yj, where x and y are real numbers, respectively called "Real" and "imaginary" of the plural.
Examples of calculations:
Each programming language has a mathematical calculation method, the mathematical symbol is universal, we all know. Directly on the code bar:
Print "I'll now count my chickens:" print "hens", + 30/6 print "Roosters", 100-25 * 3 4 print "Now I WI ll count the eggs: " print 3 + 2 + 1-5 + 4% 2-1/4 + 6 print" Is it true that 3 + 2 < 5-7? " Print 3 + 2 < 5-7 print "What's 3 + 2?", 3 + 2 print "What's 5-7?", 5-7 print "Oh, that's why it ' s fals E. " Print "How to some more."
The result of the operation should be this:
root@he-desktop:~/mystuff# python ex3.py I'll now count my chickens:hens 30Roosters 97Now I'll count the eggs:7is it T Rue that 3 + 2 < 5-7? Falsewhat is 3 + 2? 5What is 5-7? -2oh, that's why it's false.how about some more. Is it greater? Trueis it greatet or equal? Trueis it less or equal? False
Eg: convert inches and pounds into centimeters and kilograms in mathematical calculations.
1 inch = 2.54 cm, 1 lb = 0.4536 kg
My_height_centimeter = my_height * 2.54 My_weight_kilo = my_weight * 0.4536 print "He ' s%d centimeters tall."% My_height_ Centimeter print "He ' s%d kilos heavy."% My_weight_kilo