AI Term 2 Final
AI Term 2 Final
TERM 2
BY :— AGAMDEEP SINGH
1. Write a Python program to calculate the area and perimeter of a rectangle whose length and
width are taken as input form the user.
2. Write a Python program to create a list of selected children for science quiz with following names
– Arjun, Sonakshi, Vikram, Sandhya, Isha, Simran, Kartik. Perform the following tasks on the list
in sequence:
a) Print the whole list.
b) Delete the name “Vikram” from the list.
c) Add the name “Jay” at the end in the list.
d) Remove the item which is at the second position from the new list.
rite a Python program to calculate the area and perimeter of a rectangle whose length and
width are taken as input form the user.
Create a list num = [23, 12, 5, 9, 65, 44] and perform following tasks:
a) Print the length of the list.
b) Print the elements from the second to fourth position using positive indexing.
c) Print the elements from position third to fifth position using negative indexing.
Write a Python program to create a list of first 10 even
numbers and print the sum of all values of all elements in the
list.
Create a list Python List_1 = [10,20,30,30,40]. Add elements
[14,15,12] using the extend function.
Print the final list.
Write a Python program to take an integer from the user and print
“Positive Number” if the integer is positive,
“Negative Number” if the integer is negative,
and print “Zero” if it is a zero.
Write a Python program to take input two
numbers and an operator
(only +, -, *, / to be given an option)
from the user and display the result
calculated based on the operator entered.
Create a list in Python
L1 = [“Amit”, “Suman”, 4, 8, “Jack”, 9]
and write a program to remove the
second element using the remove()
function then replace the element
“Jack” with “John” and print
the new list.
Write a Python program to
print the largest of the two
numbers accepted in input
from the user.
Write a program to create a list of seven of your favorite movies and perform following tasks:
a) Print the initial list
b) Accept a new movie name from the user and insert it at a specific(third) position in the list.
c) Print the updated list.