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

Worksheet 3 Chapter 5

cs

Uploaded by

n73928957
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)
27 views2 pages

Worksheet 3 Chapter 5

cs

Uploaded by

n73928957
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

PM SHRI KV PITAMPURA DELHI – 110034

SUBJECT: COMPUTER SCIENCE (083)


CLASS: XIC
CHAPTER-5 (PYTHON INTRODUCTION)
WORKSHEET – 3

Python Practical Programs

Prog-1: Write a program in Python to print the message "Hello World!!!!"


Coding:
print("Hello World")

Output:
Hello world

Prog-2: WAP in Python to print messages in different lines.


Coding:
print("Hello World")
print("Python Rocks!!!")
print("I am learning Python")

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

Prog-4: WAP to find average of three numbers.


Coding:
n1=float(input("Enter first number"))
n2=float(input("Enter second number"))
n3=float(input("Enter third number"))
avg=(n1+n2+n3)/3
print('The Average of three numbers is',avg)

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-6: Write a program in Python to add two numbers.


Coding:
n1=int(input("Enter first number"))
n2=int(input("Enter second number"))
s=n1+n2
print('The sum of two numbers is', s)
OR
n1=int(input("Enter first number"))
n2=int(input("Enter second number"))
print('The sum of two numbers is', n1+n2)

Prog-7: WAP to input two numbers and swap(exchange) the values.

Prog-8: WAP to enter length and breadth of Rectangle and find its Area.

Prog-9: WAP to input radius of a Circle and find Area of a Circle.

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

****************************************************************************************************************

You might also like