[go: up one dir, main page]

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

ICT Lab Tasks 4

Information and Communication Technology Lab task 4

Uploaded by

yashfeen.zahhra
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)
13 views9 pages

ICT Lab Tasks 4

Information and Communication Technology Lab task 4

Uploaded by

yashfeen.zahhra
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/ 9

NAME: YASHFEEN CLASS: BEE-16C

ZAHRA
CMS ID 504292 LAB: ICT

2. Relational Operators
Task 1: Write a Python program to compare two user-entered numbers using all
relational operators.

Output:

Task 2: Create a function that takes two numbers as input and checks if the first
number is greater than or equal to the second.

Output:
3. Conditional Statements:
Task 1: Write a Python program that asks for the user's age and prints whether they
are a child, teenager, or adult

Output:

Task 2: Write a Python program that checks if a number is positive, negative, or


zero.

Output:
4. Logical Operators:
Task 1: Write a Python program that checks if a number is between 1 and 100 using
logical operators.

Output:

Task 2: Write a Python program that verifies if a person can vote (age ≥ 18) and is a
registered voter

Output:

5. Arrays in Python

Task 1: Write a Python program that creates an array of 5 numbers and prints the
sum of all elements.
Output:

Task 2: Create an array and find the maximum and minimum value.

Output:

6. Lists in Python:
• Task 1: Create a list of 4 elements, modify the second element, and print the
updated list.

Output:
Task 2: Write a Python program that sorts a list of numbers in descending order and
removes duplicates.

Output:

7. Tuples in Python:
• Task 1: Create a tuple with 4 elements. Print the second and third elements:

Output:

• Task 2: Write a Python program to join two tuples and print the result.
Output:

8. Dictionaries in Python:
• Task 1: Write a program that creates a dictionary with 3 items (name, age, city).
Add a new key-value pair and print the updated dictionary

Output:

• Task 2: Write a Python script to check if a given key exists in a dictionary.

Output:
9. Sets in Python:
Task 1: Write a Python program to create a set of numbers, add two elements, and
remove one element.

Output:

Task 2: Create two sets and find their union and intersection.

Output

10. Loops in Python (For and While):


Task 1: Write a program that prints numbers from 1 to 10 using a for loop.
Output:

Task 2: Create a Python program that calculates the factorial of a number using a
while loop.

Output:

• Task 3: Write a Python script to display a multiplication table of a number using a


for loop.
Output:

You might also like