- 2

Pls what is the meaning of %in python

22nd Jun 2021, 6:54 PM
Muhammad Auwal
Muhammad Auwal - avatar
5 ответов
23rd Jun 2021, 5:10 AM
Cmurio
Cmurio - avatar
+ 1
depends where you use it. it can mean remainder as in 10 % 3 = 1 where 1 is the remainder its also used with c style formatting (but you're better off using f strings)
22nd Jun 2021, 7:11 PM
Slick
Slick - avatar
+ 1
To get the remainder of a division, Python 3 uses the percent symbol "%". Remainder is the part of the number remaining after integer division. The operation of taking the remainder is used to solve various types of problems. For exemple: print (10 % 3) # Output: 1 The determination of the remainder of a division is very often used in programs to find, say, even numbers. Or, for example, if data processing is performed in a loop Learn: https://realpython.com/python-modulo-operator/ 
22nd Jun 2021, 7:29 PM
SammE
SammE - avatar
+ 1
The % operator is generally used to show the remainder of a certain division. For example, in python 3.x if you have 21 / 3, it will give 7.0, so it returns the whole result, not just the quotient as happens in python 2.x : print(21 / 3) or print(21/4) But the expression : 21 % 3 will return 0 as it returns the remainder of this division. This operator will always return an integer : print(21 % 3) or print(21%4) In the other hand, it is used as an format operator in strings to make a format process just like in C language. For example: print('%d \n%f \n%.5f \n%X \n%s \n%s'% (1,2,1/3,123,'hi',['t','h','e','r','e'])) This will print all the arguments is their correspondent order in the terminal. This type of formatting is used least, as for this purpose is used the .format() method of strings, making string formatting more pythonic 😁.
22nd Jun 2021, 8:05 PM
Ervis Meta
Ervis Meta - avatar
0
You can also read at this link below for more info : https://realpython.com/JUMP_LINK__&&__python__&&__JUMP_LINK-string-formatting/
22nd Jun 2021, 8:12 PM
Ervis Meta
Ervis Meta - avatar