Worksheet 3 Chapter 5
Worksheet 3 Chapter 5
Output:
Hello world
Output:
Hello world
Python Rocks!!!
I am learning Python
Prog-3: WAP in Python to accept name of the user and print the message
"Welcome <Username>"
Coding:
name=input("Enter your name")
print("Welcome" , name)
Input:
Enter your name: Rohit
Output:
Welcome Rohit
Input:
Enter first number 5
Enter second number 10
Enter third number 18
Output:
The Average of three numbers is 11.0
Prog-5: write a Python program to combine first name and surname.
Coding:
fn=input("Enter your first name")
ln=input("Enter your surname")
name=fn+' '+ln
print('Welcome ' ,name, ' in Python world')
OR
fn=input("Enter your first name")
ln=input("Enter your surname")
print("Welcome" , fn, “ “ , ln, “in Python world”)
Input:
Enter your first name: Aditya
Enter your surname: Kumar
Output:
Welcome Aditya Kumar in Python world
Prog-8: WAP to enter length and breadth of Rectangle and find its Area.
Prog-10: Write a Python program to calculate Simple Interest (SI) = (P x R x T)/ 100.
Where P-Principal, R-Rate and T-time are given as input to the program.
Prog-11: WAP to accept marks of five subjects and display total marks and percentage
of a student.
Prog-12 WAP a Python program that asks for user’s height in centimetres and then
converts user’s height to feet and inches. (1 foot = 12 inches, 1 inch = 2.54 cm).
****************************************************************************************************************
Prepared by: Vijay Chawla, PGT(CS), PM SHRI KV Pitampura, Delhi
****************************************************************************************************************