Python: Display a sample examination schedule
Python Basic: Exercise-9 with Solution
Exam Schedule Formatter
Write a Python program to display the examination schedule. (extract the date from exam_st_date).
exam_st_date = (11, 12, 2014)
Sample Output: The examination will start from : 11 / 12 / 2014
Pictorial Presentation:
Sample Solution:
Python Code:
# Define a tuple called 'exam_st_date' containing the exam start date in the format (day, month, year)
exam_st_date = (11, 12, 2014)
# Print the exam start date using string formatting
# The '%i' placeholders are filled with the values from the 'exam_st_date' tuple
print("The examination will start from : %i / %i / %i" % exam_st_date)
Sample Output:
The examination will start from : 11 / 12 / 2014
Explanation:
The said code creates a tuple called "exam_st_date" containing three integers: 11, 12, and 2014. It then uses string formatting to print a string that states "The examination will start from :" followed by the integers in the tuple in the order they appear, formatted as day/month/year. The placeholders %i are used to format the integers.
The output would be: "The examination will start from : 11 / 12 / 2014".
Flowchart:
Python Code Editor:
Previous: Write a Python program to display the first and last colors from the following list.
Next: Write a Python program that accepts an integer (n) and computes the value of n+nn+nnn.
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://www.w3resource.com/python-exercises/python-basic-exercise-9.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics