Uploaded by Joel Mendonca

AI Project File: Python Code Examples

advertisement
DELHI PRIVATE SCHOOL
SHARJAH
DEPARTMENT OF COMPUTER SCIENCE
CERTIFICATE
Certified that the work in this file is the Bona fide work of Joel
Mendonca of class X M Roll Number 12 recorded in the school
labs during the academic year 2022 – 2023
Date:26 January 2023
_________________
Teacher in charge
1 / 35 | P a g e
___________________
External Examiner
CLASS X- Artificial Intelligence (417)
PROJECT FILE : 2022-2023
Student name: Joel mendonca
Class & sec: 10 M
Roll no: 12
2 / 35 | P a g e
Advance python programs INDEX
SNO
TOPIC
Page No.
1
Python Basics
4
2
Lists
14
3
Conditional Statement
19
4
Looping with FOR statement
25
5
Looping with While statement
30
Question 1:
3 / 35 | P a g e
Code:
Output:
Question 2:
Two numbers num1 and num2 are given. Find the addition of these two numbers.
Code:
Output:
Question 3:
4 / 35 | P a g e
Find the addition of two numbers provided by user input.
Code:
Output:
Question 4:
Calculate the energy using the formula: energy= mgh for the mass, acceleration,
height.
Code:
Output:
5 / 35 | P a g e
Question 5:
Find the simple interest and display the datatype of all the variables. (SI=PTR/100).
Code:
Output:
Question 6:
Code:
6 / 35 | P a g e
Output:
Question 7:
Find the factorial of 6.
Code:
Output:
Question 8:
Calculate the displacement using the formula: displacement=ut+1/2at2. Read input
values from the user.
Code:
Output:
7 / 35 | P a g e
Question 9:
Code:
Output:
8 / 35 | P a g e
Question 10:
Print all the above details using one print function and (+) operator.
Code:”
Output:
9 / 35 | P a g e
Lists
Question 11:
WAP to create a list of first 5 natural numbers and display its sum & average.
Code:
Output:
5
Question 12:
WAP to create a list of first 5 natural numbers and display the square of odd
numbers
Code:
Output:
Question 13:
WAP to create a list of first 5 multiples of number input by the user.
10 / 35 | P a g e
Code:
Output:
Question 14:
WAP to create a list of oceans in the order of names and print it in reverse order
Code:
Output:
Question 15:
Given a list, WAP to swap first and last element of the list using inbuilt functions
list.pop(), list.insert(), list.append()
Code:
Output:
11 / 35 | P a g e
Conditional statements
Question 15
WAP to display the maximum of 2 numbers
Code:
Output:
Question 16
Find maximum of three given numbers.
Code:
Output:
12 / 35 | P a g e
Question 17
Write a program to check whether the entered number is odd or even or zero.
Code:
Output:
Question 18
A tours and travels company charges their customer as per following criteria according to
customer category:
Code:
Output:
13 / 35 | P a g e
Question 19
Read the salary and appraisal score of the user. WAP to implement an increment to the
employee’s salary based on their appraisal score given in the following table:
Code:
Output:
Python For Loop Statements
Question 20
Write a program to print first 10 natural numbers
Code:
14 / 35 | P a g e
Output:
Question 21
Write a program to print “Artificial Intelligence” 5 times
Code:
Output:
Question 22
Write a program to read the start and end of a range. Print numbers between them
Code:
15 / 35 | P a g e
Output:
Question 23
WAP to print the first ten multiples as a multiplication table of a number read from the user.
Code:
Output:
16 / 35 | P a g e
Question 24
Write a program to make a list of 7 emirates of UAE and print it using for loop.
Code:
Output:
Python While Loop Statements
Question 25
WAP to display a menu-driven output that allows the user to read two numbers and print their sum,
difference, product, quotient, reminder, and so on until the user choice is "yes".
Code:
Output:
17 / 35 | P a g e
18 / 35 | P a g e
Download