Lab 1
Lab 1
Script Soln
import sys # Import the sys module to access system-
specific parameters and functions
3. Write a Python program that calculates the area of a circle based on the radius
entered by the user.
Sample Output :
r = 1.1
Area = 3.8013271108436504
Soln
# Import the 'pi' constant from the 'math' module to
calculate the area of a circle
from math import pi
4. Write a Python program that accepts the user's first and last name and prints
them in reverse order with a space between them.
Soln
# Prompt the user to input their first name and store it in
the 'fname' variable
fname = input("Input your First Name : ")
Soln
# Prompt the user to input a sequence of comma-separated
numbers and store it in the 'values' variable
values = input("Input some comma-separated numbers: ")