This forum is now read-only. Please use our new forums! Go to forums
% Operator ?
Throughout the course i have seen different letters used with the % operator. Example- (“%.2f” % total), or “this is %s or %s.” % ( x, y,) or in the classes course %d was used. Do the letters have some significance. Is ‘s’ used for strings? Also can you decode the ‘%.2f” in the first example above. Why the % operator then a dot before 2f? And what does 2f refer to? This is from tip calculator, lesson 5/5 Thank you.
Answer 54319e48282ae3b576005ca0
1 vote
You aren’t supposed to know that yet, that is for later on. (:
Popular free courses
- Free Course
Learn SQL
In this SQL course, you'll learn how to manage large datasets and analyze real data using the standard data management language.Beginner friendly,4 LessonsLanguage Fluency - Free Course
Learn JavaScript
Learn how to use JavaScript — a powerful and flexible programming language for adding website interactivity.Beginner friendly,11 LessonsLanguage Fluency - Free Course
Learn HTML
Start at the beginning by learning HTML basics — an important foundation for building and editing web pages.Beginner friendly,6 LessonsLanguage Fluency
5 comments
Wait a minute, I asked after I finished the course. It’s not fair to keep secrets.
I got that %d is numbers and %s is strings, is f function related?
Idk
the ‘2’ in 2f refers to the padding around the number,you have the correct basic idea just relax.
Saved, thanks!