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

Chapter2 Programs

Uploaded by

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

Chapter2 Programs

Uploaded by

mahiburr167
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

Chapter-2

Practice Assignments
1.Python Program to Calculate the Area of a Triangle area=0.5*b*h, b=base ,
h=height, take the inputs from user.
2.Python Program to Generate a Random Number
3.Write a python program to calculate the length of a string =”The art of
crafting a single sentence brings together subjects, verbs, and objects with
cohesion.”
4.Print “are you” from the string my_string = ”Hello Ram Where are you
going”
5.Separate all lower case letters, upper case letters ,special characters &
numbers from given string my_string=”ASdfesD@#HBDHB&^GUV
%^*H45fdvnhw74w5e54uuU”
Print the given string by the order of given below.
1. Uppercases
2. Lowercases
3. Special Characters
4. Numbers
Graded Assignments

PA : DS1
PROBLEM STATEMENT
Write a Python script to concatenate following dictionaries to create a new one.
Sample Dictionary : dic1={1:10, 2:20} dic2={3:30, 4:40} dic3={5:50,6:60}

PA : DS2
PROBLEM STATEMENT
Given a Python list. Turn every item of a list into its square a List = [1, 2, 3, 4, 5, 6, 7]
PA : DS3
PROBLEM STATEMENT
Remove empty strings from the list of strings:
list1 = ["Mike", "", "Emma", "Kelly", "", "Brad"]

PA : DS4
PROBLEM STATEMENT
Access value 20 from the following tuple

aTuple = ("Orange", [10, 20, 30], (5, 15, 25))

PA : DS5
PROBLEM STATEMENT
Given two Python sets, update first set with items that exist only in the first
set and not in the second set.

set1 = {10, 20, 30}


set2 = {20, 40, 50}

You might also like