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

Aayush Tiwari2

The document contains a series of Python programming exercises aimed at students, covering topics such as calculating simple interest, generating Fibonacci series, checking for divisibility, and determining pass/fail status based on marks. Each exercise includes code snippets, expected outputs, and prompts for user input. The exercises are designed to enhance programming skills and understanding of basic algorithms and control structures.

Uploaded by

hariombharti69
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)
9 views13 pages

Aayush Tiwari2

The document contains a series of Python programming exercises aimed at students, covering topics such as calculating simple interest, generating Fibonacci series, checking for divisibility, and determining pass/fail status based on marks. Each exercise includes code snippets, expected outputs, and prompts for user input. The exercises are designed to enhance programming skills and understanding of basic algorithms and control structures.

Uploaded by

hariombharti69
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

By - Aayush

Tiwari

Class -- XIth – C

To – Gurmeet sir
(C.S)
Q1 write a program take principal ,rate and time as input and show the
simple interest (SI=(P*R*T)/100)

P= int(input(“enter principal”))

R=int(input(“enter rate”))

T=Int(input(“enter time”))

SI=(P*R*T)/100

Print(SI)

OUTPUT

Enter principal56

Enter rate

Enter time90

Q 2 write a program to print fibonacci series upto n terms

011235813......

n=int(input("enter number of itmes"))

a=0

b=1
print(a,b,end="")

for i in range (1,n-1):

c=a+b

print(send ="")

a=b

output

b=c

enter number of itmes 5

Q 3 check for commission

unit=int(input(" Enter the unit "))

if unit > 20 or unit ==40:

print("commission is 1000")

elif unit > 1 or unit == 20:

print("commission is 500")

elif unit > 40:

print("commission is 2000")

else:

print("invalid")

--output--

Enter the unit 23

commission is 1000

Q 4 Give pythopn if statement to check if student has got more than 40


marks in all
subjects(sub1,sub2,sub3)display message "passed" otherwise display
"Failed"

a=int(input("enter marks of sub1"))

b=int(input("enter marks of sub2"))

c=int(input("enter marks of sub3"))

if a>40 and b>40 and c>40:

print("passed")

else:

print("Failed")

Output

enter marks of sub156

enter marks of sub267

enter marks of sub378

passed

Q 5 .Write a program to take one no from user and check it is divisible by 5


and 2(both) or not

a=int(input("enter number"))

if a%2 or a%5 ==0:

print("divisible")

else:

print("not divisible")

Output

enter number67

divisible

Q 6 check for pass or fail


marks=int(input("enter marks"))

if marks>40:

print("pass")

else:

print("fail")

--output--

enter marks50

pass

Q 7 check if he can vote or not

age=int(input("enter the age"))

if age>=18:

print("You can vote")

else:

print("you are minor")

--output--

enter the age50

You can vote.

Q 8 Enter the day no7

sunday

print fibonacci series

n=int(input("enter no of items"))

a=0
b=1

print(a,b,end=" ")

for i in range(1,n-1):

c=a+b

print(c,end=" ")

a=b

b=c

--output--

Q 9 print number using while loop

i=1

while i<=10:

print(i)

i=i+1

--output--

10
Q11 write a program to take income as input and calculate the 40% tax.
show the tax and income after

tax .

income=int(input("enter income"))

tax=income*40/100

print("the tax is ",tax)

real=income-tax

print("the left income is ",real)

enter income57

the tax is 22.8

the left income is 34.2

Q12 write a program take principal ,rate and time as input and show the
simple interest

(SI=(P*R*T)/100)

P=int(input("enter principal"))

R=int(input("enter rate"))

T=int(input("enter time"))

SI=(P*R*T)/100

print(SI)

OUTPUT

enter principal56

enter rate78

enter time90

3931.2

Q13 Check nu mber which is greater


a=int(input("enter 1st no "))

b=int(input("enter 2st no "))

c=int(input("enter 3st no "))

if a>b and a>c:

print("1st is greater")

elif b>a and b>c:

print("2nd is greater")

elif c>a and c>b:

print("3rd no is greater")

enter 1st no 5

enter 2st no 4

enter 3st no 3

1st is greater

Q 14 enter the day no7

Sunday

print fibonacci series

n=int(input("enter no of items"))

a=0

b=1

print(a,b,end=" ")

for i in range(1,n-1):

c=a+b

print(c,end=" ")

a=b
b=c

--output—

Q15 write a program to take income as input and calculate the 40% tax.
show the tax and income after tax .

income=int(input("enter income"))

tax=income*40/100

print("the tax is ",tax)

real=income-tax

print("the left income is ",real)

enter income57

the tax is 22.8

the left income is 34.2

Q16 write a program take principal ,rate and time as input and show the
simple interest (SI=(P*R*T)/100)

P=int(input("enter principal"))

R=int(input("enter rate"))

T=int(input("enter time"))

SI=(P*R*T)/100

print(SI)

OUTPUT

enter principal56

enter rate78

enter time90

3931.2
Q17 write aprogram to take salary as input and calculate the followings:

HRA:20%OF SALARY

DA:10%OF SALARY

Gross Salary:Salary+DA+HRA

TAX:20%OF GROSS SALARY

NET SALARY=GROSS SALARY-TAX

output

s=int(input("enter salary"))

HRA=salary*20/100

DA=salary*10/100

GS=salary+DA+HRA

Tax=GS*20/100

NS=GS-Tax

print(HRA)

print(DA)

print(GS)

print(Tax)

print(NS)

Q18 take a number from user if number is 1 print "monday"if number is 2


print "tuesday"and so on till if number is other than 1 to 7 (invaild number ).

a=int(input("enter any number "))

if a==1:

print("monday")

elf a==2:

print("tuesday")

elif a==3:
print("wednesday")

elif a==4:

print("thursday")

elif a==5:

print("friday")

elif a==6:

print("saturday")

elif a==7:

print("Sunday")

output

enter any number 6

Saturday

Q19 WAP to accept a number and print the reverse of it

n=int(input("enter number"))

m=n

rev=0

while n>0:

b=n%10

rev=rev*10+b

n=n//10

print("reverse number is",rev)

output

enter number76

reverse number is 6

reverse number is 67
Q 20 write a program to print fibonacci series upto n terms

011235813……

N=int(input(“enter number of itmes”))

A=0

B=1

Print(a,b,end=””)

For I in range (1,n-1):

C=a+b

Print(send =””)

A=b

Output

B=C

Enter number of itmes5

0 11

You might also like