Python program to print your favorite poem computer science class 11 will help you to learn how to write a program in Python. So let’s start!
Topics Covered
Python program to print your favorite poem computer science class 11
In Python, this program can be done with the print() function.
Learning Objective: The use of the print() function in the Python program
Task: Write a program to print your favorite poem in Python.
Explanation – Python program to print your favorite poem computer science class 11
This program is written in Python to demonstrate the use of the print() function and input() function. The print() function will print the lines of the poem and the input() function pauses a screen and resumes by pressing any key after every stanza.
So here we go!
Steps – Python program to print your favorite poem computer science class 11
Step 1: Write the lines using the print() function along with triple quoted strings. The triple quoted string will print the poem stanza as it is.
Step 2: After every stanza a blank input() is added to pause the screen and that screen will be resumed by pressing any key.
Here the code is :
Code – Python program to print your favorite poem computer science class 11
print('''
Do not go gentle into that good night,
Old age should burn and rave at close of day;
Rage, rage against the dying of the light.''')
input()
print('''
Though wise men at their end know dark is right,
Because their words had forked no lightning they
Do not go gentle into that good night.''')
input()
print('''
Good men, the last wave by, crying how bright
Their frail deeds might have danced in a green bay,
Rage, rage against the dying of the light.''')
input()
print('''
Wild men who caught and sang the sun in flight,
And learn, too late, they grieved it on its way,
Do not go gentle into that good night.''')
Output – Python program to print your favorite poem computer science class 11
Watch this video for more understanding:
Follow this link to get all programs for computer science class 11.
I hope this program will help you to understand the concept. Feel free to ask your doubts in the comment section. Like and share this article with new Python beginners.