Novice · Formatting · 50 of 264
Date format
Read a day, a month and a year, and print the date as DD.MM.YYYY.
Input: day, month and year, one per line. Output: e.g. 05.09.2024
Examples
Input
5 9 2024
Output
05.09.2024
Input
31 12 1999
Output
31.12.1999
Input
1 1 2000
Output
01.01.2000
One more test checks other inputs when you press Check.
Stuck? The idea behind formatting
An f-string puts values into text: f"{name} is {age}". Inside the braces, a format after a colon controls how the value looks.
:.2f gives two decimal places, :5 makes room for five characters, :>5 lines up to the right, :05 fills with zeros.
price = 3.5
print(f"Total: £{price:.2f}")
print(f"{7:03}") # 007Watch for: round() can drop a trailing zero (3.50 becomes 3.5); :.2f always shows two places.