2021-01-15 python►a-basics Python-a03-Numeric This article shows the examples of Float, Integer in python 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849# different types num1 = 4 print(type(num1)) num2 = 2.1 print(type(num2)) # arithmetic operators print(5 + 2) print(5 - 2) print(5 * 2) print(5 / 2) print(5 // 2) # floor division print(3 ** 2) # exponent print(3 % 2) # modulus print(abs(-3)) # absolute print(round(3.6)) # round number 4 print(round(3.75, 1)) # round number 3.8 # calculation order print(3 + 2 * 2) print((3+2)*2) # increment num1 = 1 num1 = num1 + 1 print(num1) num2 = 1 num2 += 1 print(num2)# comparisons print(3 == 2) # equal print(3 != 2) # not equal print(3 > 2) # greater than print(3 < 2) # less than print(3 >= 2) # greater or equal print(3 <= 2) # less or equal# cast num1 = '10' num2 = '20' print(num1 + num2) # 1020 num3 = int(num1) num4 = int(num2) print(num3 + num4) # 30 Newer Python-a04-List,Tuple,Set Older Python-a02-String