0% found this document useful (0 votes)
54 views13 pages

Lab Record Programs For Ai Class 10 Term1

The document contains 20 programming exercises to practice various Python concepts like loops, conditional statements, lists, functions etc. Each exercise provides the aim, source code and output sections. The exercises cover calculating distance using a formula, floor division and modulus operator, checking voting eligibility, determining if a number is even or odd, checking temperature, calculating grades from marks, determining if a number is positive/negative/zero, checking for a leap year, summing list elements, finding the sum of natural numbers using loops, printing multiplication tables, printing odd numbers between ranges, printing numbers divisible by 6 between ranges, finding the factorial of a number, list operations like slicing, appending, removing elements, adding elements of two lists, finding the lightest student

Uploaded by

Rosie
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)
54 views13 pages

Lab Record Programs For Ai Class 10 Term1

The document contains 20 programming exercises to practice various Python concepts like loops, conditional statements, lists, functions etc. Each exercise provides the aim, source code and output sections. The exercises cover calculating distance using a formula, floor division and modulus operator, checking voting eligibility, determining if a number is even or odd, checking temperature, calculating grades from marks, determining if a number is positive/negative/zero, checking for a leap year, summing list elements, finding the sum of natural numbers using loops, printing multiplication tables, printing odd numbers between ranges, printing numbers divisible by 6 between ranges, finding the factorial of a number, list operations like slicing, appending, removing elements, adding elements of two lists, finding the lightest student

Uploaded by

Rosie
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/ 13

LAB RECORD PROGRAMS FOR AI CLASS 10 TERM1(2022-23)

Ex:1

Aim:
Write a program to calculate distance using this formula(Accept a,u & t from the user):
distance = ut+1/2at2

Source code:

Output:

Ex:2

Aim:
Write a program to demonstrate the use of floor division (//) and modulus operator (%) in
python. Accept any two numbers from the user and display the output.

Source code:

Output:
Ex:3

Aim:
Write a program to check if a person can vote. (Demonstration of if..else)

Source code:

Output:

Ex:4

Aim:
Write a program to check whether the entered number is odd or even.

Source code:

Output:

Ex:5

Aim:
Write a program to input temperature and check whether the climate is hot, moderate or
cold.

Source code:
Output:

Ex:6

Aim:
Write a program to input the marks of three subjects, take average and print the
grades accordingly. (>80-A,70-80-B,60-70-C) (Demonstration of if.elif..else)

Source code:

Output:

Ex:7

Aim:
Write a program to check whether the entered number is zero, positive or negative.
Source code:

Output:

Ex:8

Aim:
Write a program to check whether the entered year is a leap year.

Source code:

Output:

Ex:9

Aim:
Write a program to print the sum of all numbers stored in a list. (Python for loop)

Source code:

Output:
Ex:10

Aim:
Write a program to find the sum of all natural numbers up to a number entered by the user.
(Python while loop)

Source code:

Output:

Ex:11

Aim:
Write the program to print the multiplication table of a given number. (While loop)

Source code:
Output:

Ex:12

Aim:
Write a program to print the odd numbers between 10 & 100 (for loop)

Source code:

Output:
Ex:13

Aim:
Write a program to print all numbers which are divisible by 6 between 1 &100.(while loop)
Source code:

Output:

Ex :14
Aim:
To find the factorial of a given number
Source code:

Output:

Ex:15

Aim:
Predict the output:
List=['G', 'O', 'O', 'D', 'M', 'O', 'R', 'N', 'I', 'N', 'G']
print(List)
print(List[3:8])
print(List[5:])
print(List[:])
print(List[:-7])
print(List[-6:-1])
print(List[::-1])

Source code:

Output:

Ex:16

Aim:
3 methods to add elements to a list. Give examples for each.

Source code:
Output:

Ex:17

Aim:
2 methods to remove elements from the list. Give examples for each.

Source code:

Output:
Ex:18

Aim:
Write a program to add the elements of 2 lists.

Source code:

Output:

Ex:19

Aim:
Write a program to enter the weight of 15 students. Find the lightest of all.

Source code:

Output:
Ex:20
Aim:
Consider the following list: monuments=[ 'Kutub Minar', 10, 'Taj Mahal', 20, 'India Gate', 30,
'Char Minar', 40]
states=['Delhi', 'Kerala', 'Tamil Nadu', 'Bihar']

a. To insert “Red Fort” at index number 5


b. To add 50 at the end of the list
c. To add list states at the end of the list monuments
d. To replace 3rd, 4th and 5th element of the monuments list by “India”
e. To remove the third element from the list monuments
f. To delete 3rd to 5th elements from the list monuments
g. To display the index number of the element “Kerala” from the states list.
h. To check whether element 20 is present in the list or not

Source code:

a.

b.

c.

d.

e.

f.

g.

h.
Out

b.

c.

d.

e.

f.

g.

h.

You might also like