Using Python as a Calculator : Int « Data Type « Python






Using Python as a Calculator

 

print 2+2
# This is a comment
print 2+2
print 2+2  # and a comment on the same line as code
print (50-5*6)/4
print 7/3
print 7/-3

   
  








Related examples in the same category

1.Define and use intDefine and use int
2.Int: modulus (remainder), power Int: modulus (remainder), power
3. A value as a condition A value as a condition
4.Define and use integerDefine and use integer
5.Int value demoInt value demo
6.Convert String to integer (int)
7.oct and hex function
8.int function
9.convert integers to octal and hexadecimal strings with a string formatting expression:
10.Compare integers using if structures, relational operators and equality operators.Compare integers using if structures, relational operators and equality operators.