0% found this document useful (0 votes)
6 views1 page

Python File Codes Set 1

The document provides practical coding exercises for Class X students in Artificial Intelligence, focusing on the use of if(), for(), and while() statements. It includes tasks such as checking odd/even numbers, calculating grades based on percentages, and printing patterns. Each section contains specific coding challenges aimed at enhancing programming skills.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views1 page

Python File Codes Set 1

The document provides practical coding exercises for Class X students in Artificial Intelligence, focusing on the use of if(), for(), and while() statements. It includes tasks such as checking odd/even numbers, calculating grades based on percentages, and printing patterns. Each section contains specific coding challenges aimed at enhancing programming skills.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Practical File Codes

Class X Artificial Intelligence


I) if() statement
1) Write code to check whether a number is an odd or even number.
2) Write code to check whether a number is a positive or negative number
3) Write a code to check whether a letter entered by the user is a vowel or consonant.
4) Write a code to print the day of the week according to the week number entered by the
user. (1 - Sunday, 2 - Monday, ….)
5) Write code to print grade according to the following criteria of the percentage.
91-100 - A1 51-60 - C1
81-90 - A2 41-50 - C2
71-80 - B1 <40 - Needs Improvement
61-70 - B2

I) for() statement
1) Print ‘n’ multiples of ‘m’.
2) Ask user to enter ‘n’ numbers and then check all the numbers to be odd or even.
3) Write code to check if a number is odd or even. If it is odd, print its next n
consecutive numbers. If it is even, print its next n multiples.
4) Print the following series: 1/2., 2/4, 3/9. ---- n/n2
5) Print square of ‘n’ numbers in the following format:
1x1=1
2x2=4
.
.
n xn =n2
III) while() statement
1) Print sum of first n odd numbers.
2) Print user name number of times he wants
3) Write code to accept numbers till the time user keeps saying “yes”. In the end print the
sum of all the numbers and the total number of times the user typed “yes”.
4) Print the following pattern
*
**
***
****
5) Give one example of infinite loop

You might also like