0% found this document useful (0 votes)
3 views9 pages

Python Lab Report

Uploaded by

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

Python Lab Report

Uploaded by

Arnav Mahajan
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Department of

Mathematics
And Computing

Problem solving through python programming


(25242108)
Lab File
Enrollment No: Btmc24o1008
Name: Abhishek Yadav
1 . Write a program to create, concatenate and print a string
and accessing substring from a given string.
SOLUTION:
OBJECTIVE :
To write a program that demonstrates strings operations such
as
 Creation
 Concatenation
 Printing
 Accessing Substrings
CODE :
OUTPUT :

CONCLUSION :
The program successfully performed strings operations by
creating strings, concatenating them , displaying the output,
and extracting specific substrings, thereby demonstrating basic
string manipulation in programming .

2. Write a python program to create, append and remove lists


in python.
SOLUTION:
OBJECTIVE :
To write a python program that demonstrates list operations
such as
 Creation
 Appending
 Removing
CODE :

OUTPUT :

CONCLUSION :
The program successfully created a list , appended new
elements and removed specified elements thus showing how to
manipulate and manage list in python effectively .
3. Write a program to demonstrate different number data types
in python.
Solution :
Objective

To write a Python program that demonstrates different number


data types such as int, float, and complex.
Code :

Output :

Conclusion :
The program shows that Python supports integer, float, and
complex number data types, and their type can be checked
using the type() function.
4. Write a program to perform different arithmetic operations on
numbers in python.
Solution :
Objective

To write a Python program that performs different arithmetic


operations (addition, subtraction, multiplication, division,
modulus, exponent, floor division) on numbers.
Code :

Output :
Conclusion :
The program demonstrates how to apply arithmetic operators
in Python. It shows that Python supports addition, subtraction,
multiplication, division, modulus, exponentiation, and floor
division on numbers.
5. Write a program to demonstrate working with tuples in
python.
Solution:
Objective:
The objective of this program is to understand and demonstrate
the working of tuples in Python. Tuples are ordered, immutable
collections of elements that can store heterogeneous data
types such as integers, strings, or even other tuples. The
program aims to:

1.)Show how to create tuples in Python.


2.)Demonstrate accessing elements using indexing.
3.)Perform slicing operations on tuples.
4.)Illustrate concatenation of two tuples.
5.)Demonstrate repetition of tuple elements.

Code:
Output :
Conclusion :
The program demonstrates the use of tuples in Python. It
shows that tuples can store multiple values, allow indexing and
slicing, support concatenation and repetition, but unlike lists,
they are immutable (cannot be changed after creation).

You might also like