0

Python

I am learning python, and I don't understand **, // and % Examples: 3**5, 6//2, 8%7 Could you explain me those operations?

27th Nov 2016, 3:55 PM
MysticMM
MysticMM - avatar
3 Answers
+ 2
These and other arithmetic operations are documented here: https://docs.python.org/3.6/library/stdtypes.html#numeric-types-int-float-complex
27th Nov 2016, 4:24 PM
Igor B
Igor B - avatar
+ 1
** is power operation 2**3 means 2*2*2 // is whole number division 8//3 is 2 in python the sign of true division is / 8/3 is 2.66666 % is modulo, it returns the remainder of the division. 8%7 is 1, because 8//7is 1 and remains 1. better example 10%7 is 3 (10//7 is 1, remainder is 3)
27th Nov 2016, 4:14 PM
Benedek Måté Tóth
Benedek Måté Tóth - avatar
0
Ooh, okay, thank you!
27th Nov 2016, 4:15 PM
MysticMM
MysticMM - avatar