Programming with Python

⌘K
  1. Home
  2. Docs
  3. Programming with Python
  4. Variables, Expression and...
  5. Operators and Types of Op...
  6. Arithmetic Operators

Arithmetic Operators

  • Arithmetic operators are used with numeric values to perform common mathematical operations
  • Consider a = 5 b = 10

Example

a = 3
b = 2
print("a+b = ", a+b)
print("a-b =",a-b)
print("a*b =",a*b)
print("a/b =",a/b)
print("a%b=",a%b)
print("a**b = ", a**b)
print("a//b =",a//b)

Output

('a+b = ', 5)
('a-b =', 1)
('a*b =', 6)
('a/b =', 1)
('a%b=', 1)
('a**b = ', 9)
('a//b =', 1)

Loading

Views: 2

How can we help?

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments