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

Name: Pranav Sandip Wadge. Roll - No:03. Branch: TYCO.

The document describes 4 Python programs that perform operations on lists: 1) Sums the values in a dictionary, 2) Multiplies each number in a list by 2, 3) Finds the largest number in a list, 4) Finds the smallest number in a list.

Uploaded by

Pranav Wadge
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)
25 views2 pages

Name: Pranav Sandip Wadge. Roll - No:03. Branch: TYCO.

The document describes 4 Python programs that perform operations on lists: 1) Sums the values in a dictionary, 2) Multiplies each number in a list by 2, 3) Finds the largest number in a list, 4) Finds the smallest number in a list.

Uploaded by

Pranav Wadge
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/ 2

PRACTICAL NO.

Name: Pranav Sandip Wadge.

Roll_No:03.

Branch: TYCO.

--------------------------------------------------

X1. print(f"The list after multiplying each


number by 2 is:= {multiplied_numbers}")
1]
Output:
mylist = {'l': 9, 's': 30, 'p': 10}
=============== RESTART: C:\Users\
total = sum(mylist.values())
Admin\Desktop\pranav\mullist.py
print(total) ===============

Output: The list after multiplying each number by


2 is:= [81, 90, 270, 270]
=============== RESTART: C:\Users\
Admin\Desktop\pranav\sumitem.py --------------------------------------------------
===============
3]
49
numbers = [12, 45, 78, 23, 56, 799, 34]
--------------------------------------------------

if not numbers:
2]
print("The list is empty.")
numbers = [9,10,30,30]
else:

largest = numbers[0]
if not numbers:

print("The list is empty.")


fornum in numbers[1:]:
else:
ifnum> largest:
multiplied_numbers = [num * 9 for num in
largest = num
numbers]

print(f"The largest number in the list is:=


{largest}")
PRACTICAL NO.6

Output:

============== RESTART: C:\Users\


Admin\Desktop\pranav\largrelist.py
=============

The largest number in the list is:= 799

--------------------------------------------------

4]

numbers = [2, 50, 57, 28, 31, 7, 45]

if not numbers:

print("The list is empty.")

else:

smallest = numbers[0]

fornum in numbers[1:]:

ifnum< smallest:

smallest = num

print(f"The smallest number in the list is:=


{smallest}")

Output:

============== RESTART: C:\Users\


Admin\Desktop\pranav\smalllist.py
==============

The smallest number in the list is:= 2

**********************

You might also like