0% found this document useful (0 votes)
10 views2 pages

Pyhw 1

The document contains three Python programming homework assignments. The first program requires printing a multiplication table for 13.1, the second program formats and prints a specific string, and the third program calculates the area of a circle based on user input for the radius. Each program includes a solution with example code snippets.

Uploaded by

Subhodeep Chanda
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views2 pages

Pyhw 1

The document contains three Python programming homework assignments. The first program requires printing a multiplication table for 13.1, the second program formats and prints a specific string, and the third program calculates the area of a circle based on user input for the radius. Each program includes a solution with example code snippets.

Uploaded by

Subhodeep Chanda
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

PYTHON PROGRAMMING HOMEWORK – 1

Program 1:
Print a table of 13.1 from 1 to 12

Solution:

Program 2:
Write a Python program to print the following string using the specific format (see the
output). Sample String : "Twinkle, twinkle, little star, How I wonder what you are! Up above
the world so high, Like a diamond in the sky. Twinkle, twinkle, little star, How I wonder what
you are"
Output :

Twinkle, twinkle, little star,


How I wonder what you are!
Up above the world so high,
Like a diamond in the sky.
Twinkle, twinkle, little star,
How I wonder what you are
Solution:
print("Twinkle, twinkle, little star,\n\tHow I wonder what you
are!\n\t\tUp above the world so high,\n\t\tLike a diamond in the
sky.\nTwinkle, twinkle, little star,\n\tHow I wonder what you are")

Program 3
Write a Python program that calculates the area of a circle based on the radius entered by
the user. Hints : Define a function first. Import anything you need from the math module.

Solution:
r = float(input("enter radius of circle="))
enter radius of circle=34.562
>>> area = f'{3.14*r*r: 0.01f}'
>>> print("area of circle is=", area)

You might also like