Please what is thé use or This signe // | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Please what is thé use or This signe //

// , %

21st Apr 2022, 11:36 PM
Nōella Noëlle
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)
22nd Apr 2022, 1:05 AM
Slick
Slick - avatar
+ 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.
21st Apr 2022, 11:52 PM
William Owens
William Owens - avatar
+ 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.
22nd Apr 2022, 6:09 AM
Lisa
Lisa - avatar
+ 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
22nd Apr 2022, 10:55 AM
Lothar
Lothar - avatar
+ 2
Lisa & Lothar Those are great points about how we use tokens for different purposes in different languages.
22nd Apr 2022, 11:10 AM
William Owens
William Owens - avatar