+ 2

Python: what is %

What is %

27th Dec 2022, 10:22 AM
Khaled Alsaadi
14 Respuestas
+ 4
Frugally , X%Y is the remainder of dividing X by Y .
27th Dec 2022, 12:49 PM
Ben Hamida Mohamed Amine
Ben Hamida Mohamed Amine - avatar
+ 9
Khaled Alsaadi , can you please post a snippet with the code that contains the '%' character? it can have different meanings: > ... 7 % 5 => it is used as modulo operator > datetime.strptime(dt_string, "%m/%d/%Y") => it is used as a placeholder for date or time conversion you can try to use the search bar in sololearn. go to *discuss*, then select *most resent*. click on the searchbar and enter '% python'.
27th Dec 2022, 12:00 PM
Lothar
Lothar - avatar
+ 5
Kimberley , may be you are confused by whatever. *** your assertion that 26 modulo 6 equals 1 is completely false *** you can see the results in the small code snippet, and what a surprise, python in sololearn and in any other code editor is giving the same correct answer. print(26 % 6) # result => 2 print(26 // 6) # result => 4, # proof: 26 - (4 * 6) => 2 also your assertion that 50 divided by 5 has no remainder is not correct. it has a remainder that is 0.
28th Dec 2022, 4:18 PM
Lothar
Lothar - avatar
+ 4
Malchiel Nkhata , first of all you have to decide what kind of program you wanted to do. if you like to learn a programming language, you could start with *python for beginners*. you will learn all the basics of this language. you can find the python tutorial here: https://www.sololearn.com/Course/Python-for-Beginners/?ref=app
28th Dec 2022, 12:02 PM
Lothar
Lothar - avatar
+ 1
The modulo operator is generally used to get the reminder >Print (5 % 2) Output: 1
28th Dec 2022, 9:52 AM
Traits
Traits - avatar
+ 1
% men's remainder for example 5%2 is 1 2*2=4 remainder 1 so ans 1
29th Dec 2022, 5:01 AM
manoj nerella
manoj nerella - avatar
+ 1
The remainder of a division operation. E.g 9/2=4 remainder 1. The 1 is the % in python.
29th Dec 2022, 9:44 AM
CodeName47
CodeName47 - avatar
0
Help Guys,how can start learning coding starting from the bigginig
27th Dec 2022, 11:25 PM
Malchiel Nkhata
Malchiel Nkhata - avatar
0
%is a modulo operator, used for getting remainder when we divide 2 numbers Example: 5/2 here quotient is 2 and 5%2 here remainder is 1
28th Dec 2022, 5:10 AM
GOWDHAMI
GOWDHAMI - avatar
0
The symbol '%' in math equation is simply a rainier and that means when you devide a number by another In a simpler way, in the equation: 26%4, multiply the number 4 until it is near to 26, and that will be 4*6 : 24, then minus 26 from 24 and the remainder is 2. And if we have the equation 24%4 the result will be 0 because it has no remainder as it can be multiplied by 4. Hopefully I have explained it in a good way, I might have some small mistakes but the main idea is clear hopefully.
28th Dec 2022, 8:26 PM
Karim Maasarani
Karim Maasarani - avatar
0
It's is the Mod of an operation
29th Dec 2022, 3:35 AM
CHENYIKA TINASHE L (ZW)
CHENYIKA TINASHE L (ZW) - avatar
0
No % = 1 (remainder of the divisional operation)
29th Dec 2022, 4:58 PM
CodeName47
CodeName47 - avatar