0% found this document useful (0 votes)
10 views3 pages

Program List

Uploaded by

jerrinantonio
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)
10 views3 pages

Program List

Uploaded by

jerrinantonio
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

Python Programs list for class X -Artificial Intelligence

[Link] to add two numbers by taking input from the user


a=int(input("Enter first number:"))
b=int(input("Enter second number:"))
c=a+b
print("The sum of two numbers=",c)

[Link] to print area of circle or perimeter of circle


r=float(input("Enter the radius of the circle:"))
print("Menu")
print("[Link] of circle")
print("[Link] of circle")
ch=int(input("Enter your choice(1/2):"))
if ch==1:
print("Area of circle=",(3.14*r*r))
else:
print("Perimeter of circle=", (2*3.14*r))

[Link] to take input percentage and print grade


per=float(input("Enter percentage: "))
if per>=90:
print('Your grade is A')
elif per>=60 and per<90:
print('Your grade is B')
else:
print('Your grade is C')

[Link] to input age and whether person is a child ,teenager or an adult


age=int(input("Enter the age:"))
if age<13:
print("The person is a child")
elif age>=13 and age<18:
print("The person is a teenager")

else:
print("The person is an adult")

[Link] to take input of a string and reverse it


x=input("Enter a string:")
print(x[::-1])

[Link] to take input of a string and toggle the case of each character
x=input("Enter a string:")
y=[Link]()
print("Original string is",x)
print("New string is",y)
[Link] to take input of a string and count number of uppercase, lowercase
#digits and special characters in it
x=input("Enter a string:")
u=0
l=0
d=0
s=0
for ch in x:
if [Link]():
u+=1
elif [Link]():
l+=1
elif [Link]():
d=d+1
else:
s=s+1
print("No. of uppercase characters=",u)
print("No. of lowercase characters=",l)
print("No. of digits=",d)
print("No. of special characters=",s)

[Link] to take input of a string and check if its a palindrome


x=input("Enter a string:")
y=x[::-1]
if x==y:
print("Entered string is a palindrome")
else:
print("Entered string is not a palindrome")

[Link] to take input of a string and find its length.


x=input("Enter a string:")
y=len(x)
print("Length of the entered string is",y)

[Link] to take input of two lists and join them


L1=eval(input("Enter first list:"))
L2=eval(input("Enter second list:"))
L3=L1+L2
print("The join of two lists is",L3)

11. program to take input of a list and replicate it thrice


L=eval(input("Enter a list:"))
L1=L*3
print("Replicated list=",L1)

[Link] to take input of a number and print its table


n=int(input("Enter a number:"))
for i in range(1,11):
print(n,'X',i,'=',n*i)

[Link] to input a number and check if its a palindrome


n=int(input("Enter a number:"))
rev=0
num=n
while n!=0:
d=n%10
rev=rev*10+d
n=n//10
if num==rev:
print("Entered number is a palindrome")
else:
print("Entered number is not a palindrome")

[Link] to take input of three numbers and print the maximum number
a=int(input("Enter first number:"))
b=int(input("Enter second number:"))
c=int(input("Enter third number:"))
max=a
if b>max:
max=b
elif c>max:
max=c
print("Maximum number is",max)

[Link] to display odd numbers from 1 to 100


for i in range(1,101,2):
print(i)

You might also like