25 lines
516 B
Markdown
25 lines
516 B
Markdown
|
|
String Formatting
|
||
|
|
|
||
|
|
Here are some basic argument specifiers you should know:
|
||
|
|
|
||
|
|
%s - String (or any object with a string representation, like numbers)
|
||
|
|
|
||
|
|
%d - Integers
|
||
|
|
|
||
|
|
%f - Floating point numbers
|
||
|
|
|
||
|
|
%.<number of digits>f - Floating point numbers with a fixed amount of digits to the right of the dot.
|
||
|
|
|
||
|
|
%x/%X - Integers in hex representation (lowercase/uppercase)
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
Exercise
|
||
|
|
|
||
|
|
You will need to write a format string which prints out the data using: the following syntax: Hello John Doe. Your current balance is $53.44
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|