Artificial Intelligence
PRACTICAL FILE
AAHAN TAWAKLEY
1. To print even and odd number series from 1 to 50.
Code
Output
1
2. To check whether the year given by the user is a leap year or not.
Code
Output
3. To convert the length entered by the user in kilometres into meters.
Code
Output
2
4. To print the table of 5 up to 10 terms.
Code
Output
3
5. To print the sum of the first n natural numbers, where n is entered by the user.
Code
Output
4
6. To input a number from the user and check if the number is positive, negative, or zero
and display the appropriate message.
Code
Output
5
7. Create a list in Python of children selected for science quiz with following names:
Arjun, Sonakshi, Vikram, Sandhya, Sonal, Isha, 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
d. Remove the item which is at the second position.
Code
Output
6
8. Create a list num = [23,12,5,9,65,44]
1. Print the length of the list
2. Print the elements from second to fourth position using positive indexing
3. Print the elements from position third to fifth using negative indexing
Code
Output
9. Create a list List_1=[10,20,30,40]. Add the elements [14,15,12] using extend function.
Now sort the final list in ascending order and print it.
Code
Output
7
10. Program to
a. Print first 15 whole numbers
b. b. Print first 10 natural numbers
Code
Output