avatarLiu Zuo Lin

Summarize

Numerical Operators in Python

# Python From Zero To One (Part 3)

cover image

Day 24 of experimenting with video content (now in a series)

Basic numerical operators

# addition
print(4+5)     # 9

# subtraction
print(10-7)    # 3
print(7-10)    # -3

# multiplication
print(4*5)     # 20

# division (true division)
print(10/3)    # 3.3333333333

# floor division
print(10//3)   # 3  # quotient of 10/3

# modulus
print(10%3)    # 1  # remainder of 10/3

# exponentiation
print(2**3)    # 8

Basic numerical operators for strings

# concatenation
print('apple' + 'pie')    # applepie

# multiplication
print('apple'*3)          # appleappleapple

Conclusion

Hope this was clear and easy to understand.

Some Final words

If this story was helpful and you wish to show a little support, you could:

  1. Clap 50 times for this story
  2. Leave a comment telling me what you think
  3. Highlight the parts in this story that resonate with you

These actions really really help me out, and are much appreciated!

Ebooks I’ve Written: https://zlliu.co/ebooks

LinkedIn: https://www.linkedin.com/in/zlliu/

Python
Python3
Programming
Coding
Recommended from ReadMedium