Introduction to Python
Introduction to Python
Operations and Variables
1
Topics
1) Arithmetic Operations 2) Floor Division vs True Division 3) Modulo Operator 4) Operator Precedence 5) String Concatenation 6) Augmented Assignment
2
Arithmetic Operations
3
Mixing Types
Any expression that two floats produce a float.
x = 17.0 ? 10.0
print(x)
# 7.0
When an expression's operands are an int and a float, Python automatically converts the int to a float.
x = 17.0 ? 10 print(x) y = 17 ? 10.0 print(y)
# 7.0 # 7.0
4
True Division vs Floor Division
The operator / is true division and the operator // returns floor division(round down after true divide).True divide / always gives the answer as a float.
print(23 // 7) print(3 // 9) print(-4 // 3) print(6 / 5) print(6 / 3)
# 3 # 0 # -2 # 1.2 # 2.0 NOT 2!
5
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- python course
- operators and expressions
- learn python 3 syntax
- basics of python programming
- everything you need to know about modular arithmetic
- 0 5 lab introduction to python—sets lists dictionaries
- introduction to python
- modulo a prime number
- python and fme safe software
- introduction to computers laboratory manual experiment 3
Related searches
- introduction to financial management pdf
- introduction to finance
- introduction to philosophy textbook
- introduction to philosophy pdf download
- introduction to philosophy ebook
- introduction to marketing student notes
- introduction to marketing notes
- introduction to information systems pdf
- introduction to business finance pdf
- introduction to finance 15th edition
- introduction to finance books
- introduction to finance online course