Python Practical File
Python Practical File
Of
Problem Solving using
Python Programming
23CS001
Submitted
In partial fulfillment for the award of the degree
Of
BACHELOR OF ENGINEERING
In
COMPUTER SCIENCE & ENGINEERING
CHITKARA UNIVERSITY
CHANDIGARH-PATIALA NATIONAL HIGHWAY
RAJPURA(PATIALA) PUNJAB-140401 (INDIA)
December, 2023
Submitted To: Submitted By:
Faculty Name: Shanky Goel Name: Himanshu Singh
Designation: Professor Roll No: 2310991848
Chitkara University, Punjab Sem, Batch: 1st, 2023-2024
Problem Solving using Python Programming (23CS001)
INDEX
Sr Practical Name Teacher
No. sign
1. a) Write a Python Program to Calculate the area of a triangle.
b) Write a Python Program to Swap two variables.
c) Write a Python Program to convert Celsius to Fahrenheit.
2. a.) Write a Python Program to Check if a Number is Odd or Even
b.) Write a Python Program to Check if a Number is Positive, Negative or 0
c.) Write a Python program to Check Armstrong Number
3. a.) Write a Python program to print n Fibonacci Numbers.
b.) Write a Python program to print cube sum of first n natural numbers.
c.) Write a Python program to print all odd numbers in a range.
4. a.) Write a Python Program to Print Pascal Triangle
Hint: Enter number of rows: 4
1
1 1
1 2 1
1 3 3 1
b.) WAP to Draw the following Pattern for n number: 1 1 1 1 1
2222
333
44
5
5. Write a program with a function that accepts a string from keyboard and create a new
string after converting character of each word capitalized. For instance, if the sentence
is
“stop and smell the roses” the output should be “Stop And Smell The Roses”
6. a.) Write a program that accepts a list from user. Your program should reverse the
content of list and display it. Do not use reverse () method.
b) Find and display the largest number of a list without using built-in function max().
Your program should ask the user to input values in list from keyboard.
7. Find the sum of each row of matrix of size m x n. For example, for the following matrix
output will be like this:
Sum of row 1 = 32
Sum of row 2 = 31
Sum of row 3 = 63
Program 1:
Output:
Output:
Output:
Program 2:
Output:
Solution:
Output:
Output:
Program 3:
Output:
Solution:
Output:
Output:
Program 4:
Output:
Solution:
Output:
Program 5:
Output:
Program 6:
Output:
Output:
Program 7:
Output:
Program 8:
Output:
Output:
Output: