0
Please what is thé use or This signe //
// , %
5 Answers
+ 4
To add to William's answer, "//" or the hard division (division with no remainder) sign acts as so:
5 // 2 == 2
because it drops the remainder, (5 / 2 == 2.5)
+ 3
If you are talking about '%' it is a modulo operator which is basically the remainder of a division operation.
4%2 == 0 because 4 divided by 2 is 2 with zero remainder.
So 4%2+5 == 5
Hope that helps.
+ 2
Some programming languages use // for comments. This is why it is crucial to đmention the relevant programming language.
The operators are also explained in đlesson 5 of the sololearn Python Core course. Yiu can re-read them as often as you like.
+ 2
talking about python
# >>> the character '%' is also used as placeholder for output formatting. (old version)
name = "tom"
age = 28
print("%s is %s years old." % (name, age))
# output is: tom is 28 years old.
# >>> the character '%' is also used with date / time formatting:
from datetime import datetime
time_data = "17/02/22"
format_data = "%d/%m/%y"
print(datetime.strptime(time_data, format_data))
# output is: 2022-02-17 00:00:00