0% found this document useful (0 votes)
101 views

Python Lab-1

This document provides instructions for 10 Python programming challenges involving strings, lists, tuples, dictionaries, conditionals, and loops. The challenges include writing programs to calculate string length, count character frequency in a string, concatenate two strings by swapping the first two characters, find the longest word in a list, print area and volume calculations with symbols, find numbers divisible by 7 and a multiple of 5 between two values, sort a list of tuples by the last element, find the max of three numbers, reverse a string, and define a function to evaluate an equation.

Uploaded by

Rahul Singhal
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)
101 views

Python Lab-1

This document provides instructions for 10 Python programming challenges involving strings, lists, tuples, dictionaries, conditionals, and loops. The challenges include writing programs to calculate string length, count character frequency in a string, concatenate two strings by swapping the first two characters, find the longest word in a list, print area and volume calculations with symbols, find numbers divisible by 7 and a multiple of 5 between two values, sort a list of tuples by the last element, find the max of three numbers, reverse a string, and define a function to evaluate an equation.

Uploaded by

Rahul Singhal
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
You are on page 1/ 1

Python Lab : String, List, Tuple, Dictionary, If..

else, Loops, & Functions

1. Write a Python program to calculate the length of a string

2. Write a Python program to count the number of characters (character frequency) in a


string.
Sample String : google.com' Expected Result : {'o': 3, 'g': 2, '.': 1, 'e': 1, 'l': 1, 'm': 1, 'c': 1}

3. Write a Python program to get a single string from two given strings, separated by a
space and swap the first two characters of each string. Sample String : 'abc', 'xyz'
Expected Result : 'xyc abz'

4. Write a Python function that takes a list of words and returns the length of the
longest one.

5.Write a Python program to print the square and cube symbol in the area of a
rectangle and volume of a cylinder. Sample output: The area of the rectangle is
1256.66cm2 The volume of the cylinder is 1254.725cm3

6. Write a Python program to find those numbers which are divisible by 7 and multiple
of 5, between 1500 and 2700

7. Write a Python program to get a list, sorted in increasing order by the last element in
each tuple from a given list of non-empty tuples. Sample List : [(2, 5), (1, 2), (4, 4), (2, 3),
(2, 1)] Expected Result : [(2, 1), (1, 2), (2, 3), (4, 4), (2, 5)]

8. Write a Python function to find the Max of three numbers

9. Write a Python program to reverse a string. Sample String : "1234abcd" Expected


Output : "dcba4321"

10. Make a function to evaluation below mentioned equation

a.

Page 1 of 1

You might also like