0% found this document useful (0 votes)
4 views5 pages

Assignment 3 (ITC Theory)

The document is an assignment on computing submitted by Fazal-ur-Rehman to Dr. Salman Arain. It includes explanations of various programming concepts such as dictionaries, lists, and user input handling in Python. The assignment demonstrates how to manipulate data structures and categorize numbers into even and odd lists.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views5 pages

Assignment 3 (ITC Theory)

The document is an assignment on computing submitted by Fazal-ur-Rehman to Dr. Salman Arain. It includes explanations of various programming concepts such as dictionaries, lists, and user input handling in Python. The assignment demonstrates how to manipulate data structures and categorize numbers into even and odd lists.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

INTRODUCTION TO COMPUTING

ASSIGNMENT (3)
Name: Fazal-ur-Rehman
ROLL. NO: 19-ELE-11
SECTION: (A)
Group: (A)
Submitted To: Dr.Salman Arain
NFC INSTITUTE OF ENGINEERING & FERTILIZER RESEARCH
FAISALABAD, ELECTRICAL ENGINEERING DEPARTMENT

Signature
Date: 14-02-2020
SOLUTION

INPUT:

OUTPUT:
OUTPUT:

Explanation:

We make a dictionary named count and in it made a key that has a value e.g. [4,2,1]=5, later we
introduce a variable ‘tot’ that will store the values of keys in it, but we have updated the value of
[4,2,1] at the end to 2 so our tot becomes 13 and the length of dictionary count is 3 which after
addition gives us the answer 16.
OUTPUT (i):

Explanation:
We created a list named ‘L’ and stored the value ‘123456’ in it. We amended the values at index ‘0’
and ‘5’ to zero and value at index ‘3’ to the value at -2 which is index number ‘4’ and then we
printed the new updated list ‘L’.

OUTPUT (ii):

Explanation:

We will make a list named L1=[1,2,3,4] and store that in another list named L2. Then we copied the
list L1 into another list named L3. We also listed L1 in L4 and then changed the value at index ‘0’ to
‘[5]’.We printed all L1toL4 and saw L1 and L2 prints the updated list but L3 and L4 don’t because
the elements of L1 were copied in them not the list was equated to them.

OUTPUT (ii):

Explanation:

An empty list ‘a’ was created and user was asked that how many numbers should be entered. In
the loop we asked the user to enter numbers they wish to be part of the list and using append
function stored them in ‘a’. Then we introduced two empty lists named even and odd and using
append function we stored the even numbers in even list and odd numbers in odd list using if
statement and formulae. Then we printed the even and odd lists.
INPUT:

OUTPUT:

OUTPUT:

You might also like