AI Practical File Term-1
AI Practical File Term-1
Output:
Page 1 of 11
Output:
Output:
Page 2 of 11
Program 2
Write a program to calculate the sum of the first ‘n’ natural
numbers using while loop, where ‘n’ is entered by the
user.
Input:
Output:
Page 3 of 11
Program 3
Write a program to multiply all the items in a list.
Input:
Output:
Page 4 of 11
Program 4
Write a program to create a list of 5 students’ names by the
user using an append function and a for loop.
Input:
Output:
Page 5 of 11
Program 5
Write a program to create a list of any 5 fruits, and then
add another fruit to a particular index using an insert
function by the user. But if the name already exists in the
list, then an error message must be displayed.
Input:
Output:
Page 6 of 11
Program 6
Write a program to calculate the average marks of students
after reading marks in 5 subjects in the list using the
input() statement from the user.
Input:
Output:
Page 7 of 11
Program 7
Create a tuple having all the months names and print its
items using a while loop.
Input:
Output:
Page 8 of 11
Program 8
Create a tuple with any 10 numbers (2 digit each) and print
the following using suitable functions:
• Length of the tuple
• Maximum and minimum number in the tuple
• Sum of all items of a tuple
Input:
Output:
Page 9 of 11
Program 9
Write a program to check if the number entered by the user
is positive, negative or zero.
Input:
Output:
Page 10 of 11
Program 10
Write a program to accept the cost price of a bike and
display the road tax to be paid according to the following
criteria:
Cost price (in ₹) Road tax
>1,00,000 15%
>50,000 and <=1,00,000 10%
<=50,000 5%
Input:
Output:
Page 11 of 11