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

Python Programming Assignment Tasks

The document outlines an assignment for a computer programming course, specifically focusing on Python tasks. It includes various programming exercises such as string manipulation, bitwise operations, triangle validation, and creating a calculator. Each task requires students to write Python code to achieve specific outcomes based on given inputs.

Uploaded by

dakshsangwani123
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)
15 views9 pages

Python Programming Assignment Tasks

The document outlines an assignment for a computer programming course, specifically focusing on Python tasks. It includes various programming exercises such as string manipulation, bitwise operations, triangle validation, and creating a calculator. Each task requires students to write Python code to achieve specific outcomes based on given inputs.

Uploaded by

dakshsangwani123
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

COMPUTER PROGRAMMING (ES2301)

ASSIGNMENT-2
DAKSH

SID-25102031

Branch – Civil (G1)

1. For a given input string “Python is a case sensitive language”. Write

python code for the following:

a. Find the length of the input string.

b. Reverse the order of the string in one line code.

c. Using Slice function store “a case sensitive” in new string.

d. Replace “a case sensitive” with “object oriented”.

e. Find index of substring “a” in the given input string.

f. Remove the white spaces from the given input string.


2. Store your name, SID, department name and CGPA into different variables.

With the help of String formatting print the following output:

Hey, ABC Here!

My SID is 2110XXXX

I am from XYZ department and my CGPA is 9.9


3. Write a program to print the below given output on screen using different

syntax of Print function.

Hello World#This is a Class

Python%Programming%lab007"briliant" Students@and@"Superior" Studentspylab


4. For a=56 and b=10 with the help of bitwise operators calculate the following:

a. a&b

b. a|b

c. a^b

d. Left shift both a and b with 2 bits.

e. Right shift a with 2 bits and b with 4 bits.


5. Write a python program to check if the word “name” is present in the string

entered by the user (Print : “Yes” or “No”).


6. For any three lengths, there is a simple test to see if it is possible to form a

triangle. If any of the three lengths is greater than the sum of the other two,

then you cannot form a triangle. Otherwise, Enter three sides of a triangle,

Hello World#This is a Class

Python%Programming%lab007"briliant" Students@and@"Superior" Studentspylab

converts them to integers, and to check whether the given input lengths can

form a triangle or not (Print : “Yes” or “No”).


7. Given two numbers ‘a’ and b’. Write a program to count number of bits

needed to be flipped to convert ‘a’ to ‘b’.


8. Write a Program to take number as input and convert it to binary equivalent.
9. Write an interactive calculator program that should be allow user to type a

mathematical expression and print the value of expression.

You might also like