SlideShare a Scribd company logo
COMPUTER SCIENCE WITH PYTHON
PROGRAM FILE
NAME:
CLASS:
SECTION:
INDEX
S.NO TOPIC T.SIGN
1 #WAP Take two integer values from user and print greatest among them.
2 A school has following rules for grading system:
a. Below 25 - F
b. 25 to 45 - E
c. 45 to 50 - D
d. 50 to 60 - C
e. 60 to 80 - B
f. Above 80 - A
Ask user to enter marks and print the corresponding grade.
3 A company decided to give hra,da according to the foolowing criteria if his/her year
of service is
no of years hra da
more than 5 years but less than 10 years 5% 3%
more than and equal to 10 years but less than 20 years 4% 2%
more than and equal to 20 years 6% 7%
Ask user for their salary and year of service and print the net salary.
4 Program that demonstrate the use of Nested if- if within another if
5 Write a program to display the first 10 natural numbers.
6 Write a program to display n terms of natural number and their sum
7 Write a program to display the multiplication table of a given integer.
8 Program to demonstrate the concept of nested loop
9 Program to count all uppercase characters
10 Program to count no of vowels
11 Program to convert uppercase into lowercase and vice versa and not to use built in
functions
12 Program to capitalize first and last letters of each word of a given string
13 Write a program which should change all the multiples of 5 in the list to 5 and rest of
the elements as 0.
14 Write a code in python which divide all those list elements by 7 which are divisible by
7 and multiply list elements by 3.
15 Write a program in python, to add 5 in all the odd values and 10 in all the even values
of the list .
16 Program to count total prime nos within the range
17 Write a program that creates a third tuple after adding two tuples. Add
second after first tuple.
18 Program to calculate the average of the numbers of the tuple.
19 Program to store book id, book name and price of three books and store
the data in dictionary name "dict"
20 Dictionary menu based Program
Q1 #WAP Take two integer values from user and print greatest among them.
no1=eval(input("enter no1: "))
no2=eval(input("enter no2: "))
if(no1>no2):
print("no1 is greater than no2")
elif(no2>no1):
print("no2 is greater than no1")
elif(no1==no2):
print("both are equal")
else:
print("PLEASE ENTER VALID NO ONLY")
'''
output
enter no1: 3
enter no2: 4
no2 is greater than no1
'''
Q2 A school has following rules for grading system:
a. Below 25 - F
b. 25 to 45 - E
c. 45 to 50 - D
d. 50 to 60 - C
e. 60 to 80 - B
f. Above 80 - A
Ask user to enter marks and print the corresponding grade.
sol
m=int(input("enter marks"))
if(m<25):
print(" Grade F")
elif(m>=25 and m<45):
print(" Grade E")
elif(m>=45 and m<50):
print(" Grade D")
elif(m>=50 and m<60):
print(" Grade C")
elif(m>=60 and m<80):
print(" Grade B")
elif(m>=80): #else:
print(" Grade A")
#-----------------OR-----------------
m=int(input("enter marks"))
if(m<25):
print(" Grade F")
elif(m<45):
print(" Grade E")
elif(m<50):
print(" Grade D")
elif(m<60):
print(" Grade C")
elif(m<80):
print(" Grade B")
elif(m>=80): #else:
print(" Grade A")
‘’’
Output
enter marks76
Grade B
‘’’
Q3
A company decided to give hra,da according to the foolowing criteria if his/her year of service is
no of years hra da
more than 5 years but less than 10 years 5% 3%
more than and equal to 10 years but less than 20 years 4% 2%
more than and equal to 20 years 6% 7%
Ask user for their salary and year of service and print the net salary.
SOL
n=eval(input("enter salary"))
y=int(input("enter no of years"))
if(y>=5 and y<10):
h=n*0.05
d=n*0.03
#print("net salary",n+h+d)
elif(y>=10 and y<20):
h=n*0.04
d=n*0.02
#print("net salary",n+h+d)
else: #elif(y>=20):
h=n*0.06
d=n*0.07
#print("net salary",n+h+d)
print("net salary",n+h+d) #final output related to all condition
'''
output
enter salary3450
enter no of years6
net salary 3726.0
'''
Q4 #Program that demonstrate the use of Nested if- if within another if
Sol:
a=int(input("enter age"))
if(a<15):
if(a>=0 and a<=10):
print("age is between 0 to 10")
else:
print("age is greater than 10 but less than 15")
else:
print("age is greater than 15")
'''
output
enter age8
age is between 0 to 10
'''
Q5
#Write a program to display the first 10 natural numbers.
sol
for i in range(1,11):
print(i)
'''
Output
1
2
3
4
5
6
7
8
9
10
‘’’
Q6
'''
#Write a program to display n terms of natural number and their sum
'''
sol
n=int(input("enter no"))
s=0
for i in range(1,n+1):
s=s+i
print("value of natural no",i, "sum of natural no",s)
'''
output
enter no6
value of natural no 1 sum of natural no 1
value of natural no 2 sum of natural no 3
value of natural no 3 sum of natural no 6
value of natural no 4 sum of natural no 10
value of natural no 5 sum of natural no 15
value of natural no 6 sum of natural no 21
'''
Q 7
'''
#Write a program to display the multiplication table of a given integer.
'''
sol
n=int(input("enter no"))
#s=int(input("enter starting value"))
#e=int(input("enter ending value"))
for i in range(1,11):
print(n,"x",i,"=",n*i)
'''
output
enter no8
8 x 1 = 8
8 x 2 = 16
8 x 3 = 24
8 x 4 = 32
8 x 5 = 40
8 x 6 = 48
8 x 7 = 56
8 x 8 = 64
8 x 9 = 72
8 x 10 = 80
'''
Q8 # Concept of nested loop
Ans
#--------------------------------------
for i in range(4,0,-1):
for j in range(5,i,-1):
print(i,end="")
print()
'''
4
33
222
1111
'''
#another program that demonstrate the use of nested loop
for i in range(4):
for j in range(i+1):
print("*",end="")
print()
'''
*
**
***
****
'''
Q9
#Program to count all uppercase characters
sol
s=input("enter string")
c=0
for i in s:
if (i.isupper()):
c=c+1
print(c)
'''
output
enter stringTHis is my file
2
‘’’
Q10
#Program to count no of vowels
sol
s=input("enter string")
c=0
for i in s:
if i in "aeiouAEIOU":
c=c+1
print(c)
'''
output
enter stringthis is my file
4
'''
Q11
# Program to display those words which are ending with capital alphabets
s=input("enter string")
c=0
for i in s.split():
if i[-1].isupper():
c=c+1
print(c)
'''
output
enter string this is mY filE
2
'''
Q12
#Program to convert uppercase into lowercase and vice versa and not to use built in functions
S="ThiS IS mY 5678 FIle"
for i in S:
if i>"A" and i<='Z':
print(chr(ord(i)+32),end="")
elif i>="a" and i<="z":
print(chr(ord(i)-32),end="")
'''
output
tHIsisMyfiLE
'''
Q12
#Program to capitalize first and last letters of each word of a given string
Sol
s=input("enter string")
r=" "
s=s.title()
for i in s.split():
r=r+i[:-1]+i[-1].upper()+" "
print(r)
'''
output
enter stringthis is my file
ThiS IS MY FilE
'''
Q13
'''
Write a program which should change all the multiples of 5 in
the list to 5 and rest of the elements as 0.
'''
Sol
a=[2,56,78,98,90,50,45,67]
for i in a:
if(i%5==0):
i=5
print(i,end=" ")
else:
i=0
print(i,end=" ")
'''
output
0 0 0 0 5 5 5 0
'''
#OR
a=[2,56,78,98,90,50,45,67]
for i in range(len(a)):
if(a[i]%5==0):
a[i]=5
else:
a[i]=0
print(a)
'''
output
[0, 0, 0, 0, 5, 5, 5, 0]
'''
Q14'''
Write a code in python which divide all those list elements by
7 which are divisible by 7 and multiply list elements by 3.
'''
Sol
a=[2,56,78,98,90,50,45,67]
for i in a:
if(i%7==0):
i=i//7
print(i,end=" ")
else:
i=i*3
print(i,end=" ")
'''
output
6 8 234 14 270 150 135 201
'''
#OR
a=[2,56,78,98,90,50,45,67]
for i in range(len(a)):
if(a[i]%7==0):
a[i]=a[i]/7
else:
a[i]=a[i]*3
print(a)
'''
output
[6, 8.0, 234, 14.0, 270, 150, 135, 201]
'''
Q15
'''
Write a program in python, to add 5 in all the odd values
and 10 in all the even values of the list .
'''
a=[2,56,78,98,90,50,45,67]
for i in a:
if(i%2==0):
i=i+10
print(i,end=" ")
else:
i=i+5
print(i,end=" ")
'''
output
12 66 88 108 100 60 50 72
'''
Q16
'''
WAP to count total prime nos within the range
'''
a=int(input("enter starting no"))
b=int(input("enter ending limit"))
c=0
d=0
for a in range(a,b+1):
for i in range(2,a):
if(a%i==0):
c=c+1
break
else:
d=d+1
print("total not prime no",c)
print("total prime",d)
'''
output
enter starting no5
enter ending limit19
total not prime no 9
total prime 6
'''
Q17
‘’’
WAP that creates a third tuple after adding two tuples. Add second after first tuple.
‘’’
a=(1,2,3)
b=(4,5,6)
c=a+b
print(c)
‘’’
Output
(1,2,3,4,5,6)
‘’’
Q18
‘’’
WAP to calculate the average of the numbers of the tuple.
‘’’
t=eval(input("enter tuple"))
l=len(t)
a=0
s=0
for i in range(0,l):
s=s+t[i]
a=s/l
print("average of given tuple",a)
'''
output
enter tuple1,2,3,4
average of given tuple 2.5
'''
Q19
'''
WAP to store book id, book name and price of three books and store the data in dictionary name "dict"
'''
dict={}
for i in range(3):
b_id=int(input("enter book id:"))
b_name=input("enter book name:")
b_price=int(input("enter price of book:"))
dict[b_id]=b_name,b_price
print(dict)
'''
OUTPUT
enter book id:1
enter book name:abc
enter price of book:450
enter book id:2
enter book name:cs with python
enter price of book:279
enter book id:3
enter book name:cs with c++
enter price of book:350
{1: ('abc', 450), 2: ('cs with python', 279), 3: ('cs with c++', 350)}
'''
Q20
‘’’
Dictionary Menu Based
‘’’
a=0
while a!=1:
print("1. add information")
print("2. display all information")
print("3. search a particular info")
print("4. delete a particular info")
print("5. modification a particular info")
print("6. exit")
ch=int(input("enter your choice"))
d={}
if(ch==1):
n=int(input("how many elements u want to enter"))
for i in range(n):
r=input("enter rollno")
n=input("enter name")
m=int(input("enter marks"))
d[r]=n,m
print(d)
elif(ch==2):
for i in d:
print(i,d[i])
elif(ch==3):
s=input("enter the key which u want to search")
for i in d:
if(i==s):
print(d[i])
elif(ch==4):
s=input("enter the key which u want to search")
for i in d:
if(i==s):
d.pop(s)
print(d)
elif(ch==5):
s=input("enter the key which u want to search")
v=int(input("enter the value"))
d[s]=v
print(d)
elif(ch==6):
a=1
‘’’
output
1. add information
2. display all information
3. search a particular info
4. delete a particular info
5. modification a particular info
6. exit
enter your choice1
how many elements u want to enter3
enter rollno1
enter namereena
enter marks70
enter rollno2
enter nameteena
enter marks80
enter rollno3
enter namesheena
enter marks89
{'1': ('reena', 70), '2': ('teena', 80), '3': ('sheena', 89)}
1. add information
2. display all information
3. search a particular info
4. delete a particular info
5. modification a particular info
6. exit
enter your choice3
enter the key which u want to search1
('reena', 70)
1. add information
2. display all information
3. search a particular info
4. delete a particular info
5. modification a particular info
6. exit
enter your choice5
enter the key which u want to modify3
enter namemeena
enter marks97
after modification dictionary is {'1': ('reena', 70), '2': ('teena', 80), '3': ('meena', 97)}
1. add information
2. display all information
3. search a particular info
4. delete a particular info
5. modification a particular info
6. exit
enter your choice4
enter the key which u want to delete2
after deletion dictionary is {'1': ('reena', 70), '3': ('meena', 97)}
1. add information
2. display all information
3. search a particular info
4. delete a particular info
5. modification a particular info
6. exit
enter your choice6
‘’’
Q20
‘’’
Ad

More Related Content

Similar to Sample Program file class 11.pdf (20)

B.Com 1year Lab programs
B.Com 1year Lab programsB.Com 1year Lab programs
B.Com 1year Lab programs
Prasadu Peddi
 
Exercises
ExercisesExercises
Exercises
loidasacueza
 
Sasin nisar
Sasin nisarSasin nisar
Sasin nisar
SasinNisar
 
xii cs practicals
xii cs practicalsxii cs practicals
xii cs practicals
JaswinderKaurSarao
 
Chapter 1 Programming Fundamentals Assignment.docx
Chapter 1 Programming Fundamentals Assignment.docxChapter 1 Programming Fundamentals Assignment.docx
Chapter 1 Programming Fundamentals Assignment.docx
Shamshad
 
week4_python.docx
week4_python.docxweek4_python.docx
week4_python.docx
Radhe Syam
 
Computer programming subject notes. Quick easy notes for C Programming.Cheat ...
Computer programming subject notes. Quick easy notes for C Programming.Cheat ...Computer programming subject notes. Quick easy notes for C Programming.Cheat ...
Computer programming subject notes. Quick easy notes for C Programming.Cheat ...
DR B.Surendiran .
 
678676286-CLASS-12-COMPUTER-SCIENCE-PRACTICAL-FILE-2023-24.pdf
678676286-CLASS-12-COMPUTER-SCIENCE-PRACTICAL-FILE-2023-24.pdf678676286-CLASS-12-COMPUTER-SCIENCE-PRACTICAL-FILE-2023-24.pdf
678676286-CLASS-12-COMPUTER-SCIENCE-PRACTICAL-FILE-2023-24.pdf
anuragupadhyay0537
 
ANSHUL RANA - PROGRAM FILE.pptx
ANSHUL RANA - PROGRAM FILE.pptxANSHUL RANA - PROGRAM FILE.pptx
ANSHUL RANA - PROGRAM FILE.pptx
jeyel85227
 
Functions Practice Sheet.docx
Functions Practice Sheet.docxFunctions Practice Sheet.docx
Functions Practice Sheet.docx
SwatiMishra364461
 
Practical write a c program to reverse a given number
Practical write a c program to reverse a given numberPractical write a c program to reverse a given number
Practical write a c program to reverse a given number
Mainak Sasmal
 
Practical write a c program to reverse a given number
Practical write a c program to reverse a given numberPractical write a c program to reverse a given number
Practical write a c program to reverse a given number
Mainak Sasmal
 
Qust & ans inc
Qust & ans incQust & ans inc
Qust & ans inc
nayakq
 
C-LOOP-Session-2.pptx
C-LOOP-Session-2.pptxC-LOOP-Session-2.pptx
C-LOOP-Session-2.pptx
Sarkunavathi Aribal
 
C important questions
C important questionsC important questions
C important questions
JYOTI RANJAN PAL
 
Loops in Python
Loops in PythonLoops in Python
Loops in Python
Arockia Abins
 
Hargun
HargunHargun
Hargun
Mukund Trivedi
 
C lab-programs
C lab-programsC lab-programs
C lab-programs
Tony Kurishingal
 
algorithm
algorithmalgorithm
algorithm
Divya Ravindran
 
E1 – FundamentalsPlease refer to announcements for details about.docx
E1 – FundamentalsPlease refer to announcements for details about.docxE1 – FundamentalsPlease refer to announcements for details about.docx
E1 – FundamentalsPlease refer to announcements for details about.docx
jacksnathalie
 
B.Com 1year Lab programs
B.Com 1year Lab programsB.Com 1year Lab programs
B.Com 1year Lab programs
Prasadu Peddi
 
Chapter 1 Programming Fundamentals Assignment.docx
Chapter 1 Programming Fundamentals Assignment.docxChapter 1 Programming Fundamentals Assignment.docx
Chapter 1 Programming Fundamentals Assignment.docx
Shamshad
 
week4_python.docx
week4_python.docxweek4_python.docx
week4_python.docx
Radhe Syam
 
Computer programming subject notes. Quick easy notes for C Programming.Cheat ...
Computer programming subject notes. Quick easy notes for C Programming.Cheat ...Computer programming subject notes. Quick easy notes for C Programming.Cheat ...
Computer programming subject notes. Quick easy notes for C Programming.Cheat ...
DR B.Surendiran .
 
678676286-CLASS-12-COMPUTER-SCIENCE-PRACTICAL-FILE-2023-24.pdf
678676286-CLASS-12-COMPUTER-SCIENCE-PRACTICAL-FILE-2023-24.pdf678676286-CLASS-12-COMPUTER-SCIENCE-PRACTICAL-FILE-2023-24.pdf
678676286-CLASS-12-COMPUTER-SCIENCE-PRACTICAL-FILE-2023-24.pdf
anuragupadhyay0537
 
ANSHUL RANA - PROGRAM FILE.pptx
ANSHUL RANA - PROGRAM FILE.pptxANSHUL RANA - PROGRAM FILE.pptx
ANSHUL RANA - PROGRAM FILE.pptx
jeyel85227
 
Functions Practice Sheet.docx
Functions Practice Sheet.docxFunctions Practice Sheet.docx
Functions Practice Sheet.docx
SwatiMishra364461
 
Practical write a c program to reverse a given number
Practical write a c program to reverse a given numberPractical write a c program to reverse a given number
Practical write a c program to reverse a given number
Mainak Sasmal
 
Practical write a c program to reverse a given number
Practical write a c program to reverse a given numberPractical write a c program to reverse a given number
Practical write a c program to reverse a given number
Mainak Sasmal
 
Qust & ans inc
Qust & ans incQust & ans inc
Qust & ans inc
nayakq
 
E1 – FundamentalsPlease refer to announcements for details about.docx
E1 – FundamentalsPlease refer to announcements for details about.docxE1 – FundamentalsPlease refer to announcements for details about.docx
E1 – FundamentalsPlease refer to announcements for details about.docx
jacksnathalie
 

Recently uploaded (20)

How To Maximize Sales Performance using Odoo 18 Diverse views in sales module
How To Maximize Sales Performance using Odoo 18 Diverse views in sales moduleHow To Maximize Sales Performance using Odoo 18 Diverse views in sales module
How To Maximize Sales Performance using Odoo 18 Diverse views in sales module
Celine George
 
The History of Kashmir Lohar Dynasty NEP.ppt
The History of Kashmir Lohar Dynasty NEP.pptThe History of Kashmir Lohar Dynasty NEP.ppt
The History of Kashmir Lohar Dynasty NEP.ppt
Arya Mahila P. G. College, Banaras Hindu University, Varanasi, India.
 
Module 1: Foundations of Research
Module 1: Foundations of ResearchModule 1: Foundations of Research
Module 1: Foundations of Research
drroxannekemp
 
COPA Apprentice exam Questions and answers PDF
COPA Apprentice exam Questions and answers PDFCOPA Apprentice exam Questions and answers PDF
COPA Apprentice exam Questions and answers PDF
SONU HEETSON
 
INQUISITORS School Quiz Prelims 2025.pptx
INQUISITORS School Quiz Prelims 2025.pptxINQUISITORS School Quiz Prelims 2025.pptx
INQUISITORS School Quiz Prelims 2025.pptx
SujatyaRoy
 
How to Share Accounts Between Companies in Odoo 18
How to Share Accounts Between Companies in Odoo 18How to Share Accounts Between Companies in Odoo 18
How to Share Accounts Between Companies in Odoo 18
Celine George
 
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptxU3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
Mayuri Chavan
 
MEDICAL BIOLOGY MCQS BY. DR NASIR MUSTAFA
MEDICAL BIOLOGY MCQS  BY. DR NASIR MUSTAFAMEDICAL BIOLOGY MCQS  BY. DR NASIR MUSTAFA
MEDICAL BIOLOGY MCQS BY. DR NASIR MUSTAFA
Dr. Nasir Mustafa
 
How to Configure Extra Steps During Checkout in Odoo 18 Website
How to Configure Extra Steps During Checkout in Odoo 18 WebsiteHow to Configure Extra Steps During Checkout in Odoo 18 Website
How to Configure Extra Steps During Checkout in Odoo 18 Website
Celine George
 
MCQ PHYSIOLOGY II (DR. NASIR MUSTAFA) MCQS)
MCQ PHYSIOLOGY II (DR. NASIR MUSTAFA) MCQS)MCQ PHYSIOLOGY II (DR. NASIR MUSTAFA) MCQS)
MCQ PHYSIOLOGY II (DR. NASIR MUSTAFA) MCQS)
Dr. Nasir Mustafa
 
Peer Assesment- Libby.docx..............
Peer Assesment- Libby.docx..............Peer Assesment- Libby.docx..............
Peer Assesment- Libby.docx..............
19lburrell
 
IMPACT_OF_SOCIAL-MEDIA- AMONG- TEENAGERS
IMPACT_OF_SOCIAL-MEDIA- AMONG- TEENAGERSIMPACT_OF_SOCIAL-MEDIA- AMONG- TEENAGERS
IMPACT_OF_SOCIAL-MEDIA- AMONG- TEENAGERS
rajaselviazhagiri1
 
INSULIN.pptx by Arka Das (Bsc. Critical care technology)
INSULIN.pptx by Arka Das (Bsc. Critical care technology)INSULIN.pptx by Arka Das (Bsc. Critical care technology)
INSULIN.pptx by Arka Das (Bsc. Critical care technology)
ArkaDas54
 
How to Manage Manual Reordering Rule in Odoo 18 Inventory
How to Manage Manual Reordering Rule in Odoo 18 InventoryHow to Manage Manual Reordering Rule in Odoo 18 Inventory
How to Manage Manual Reordering Rule in Odoo 18 Inventory
Celine George
 
GENERAL QUIZ PRELIMS | QUIZ CLUB OF PSGCAS | 4 MARCH 2025 .pdf
GENERAL QUIZ PRELIMS | QUIZ CLUB OF PSGCAS | 4 MARCH 2025 .pdfGENERAL QUIZ PRELIMS | QUIZ CLUB OF PSGCAS | 4 MARCH 2025 .pdf
GENERAL QUIZ PRELIMS | QUIZ CLUB OF PSGCAS | 4 MARCH 2025 .pdf
Quiz Club of PSG College of Arts & Science
 
YSPH VMOC Special Report - Measles Outbreak Southwest US 5-14-2025 .pptx
YSPH VMOC Special Report - Measles Outbreak  Southwest US 5-14-2025  .pptxYSPH VMOC Special Report - Measles Outbreak  Southwest US 5-14-2025  .pptx
YSPH VMOC Special Report - Measles Outbreak Southwest US 5-14-2025 .pptx
Yale School of Public Health - The Virtual Medical Operations Center (VMOC)
 
LDMMIA Reiki Yoga S6 Free Workshop Money Pt 2
LDMMIA Reiki Yoga S6 Free Workshop Money Pt 2LDMMIA Reiki Yoga S6 Free Workshop Money Pt 2
LDMMIA Reiki Yoga S6 Free Workshop Money Pt 2
LDM & Mia eStudios
 
INDIA QUIZ FOR SCHOOLS | THE QUIZ CLUB OF PSGCAS | AUGUST 2024
INDIA QUIZ FOR SCHOOLS | THE QUIZ CLUB OF PSGCAS | AUGUST 2024INDIA QUIZ FOR SCHOOLS | THE QUIZ CLUB OF PSGCAS | AUGUST 2024
INDIA QUIZ FOR SCHOOLS | THE QUIZ CLUB OF PSGCAS | AUGUST 2024
Quiz Club of PSG College of Arts & Science
 
Rebuilding the library community in a post-Twitter world
Rebuilding the library community in a post-Twitter worldRebuilding the library community in a post-Twitter world
Rebuilding the library community in a post-Twitter world
Ned Potter
 
MICROBIAL GENETICS -tranformation and tranduction.pdf
MICROBIAL GENETICS -tranformation and tranduction.pdfMICROBIAL GENETICS -tranformation and tranduction.pdf
MICROBIAL GENETICS -tranformation and tranduction.pdf
DHARMENDRA SAHU
 
How To Maximize Sales Performance using Odoo 18 Diverse views in sales module
How To Maximize Sales Performance using Odoo 18 Diverse views in sales moduleHow To Maximize Sales Performance using Odoo 18 Diverse views in sales module
How To Maximize Sales Performance using Odoo 18 Diverse views in sales module
Celine George
 
Module 1: Foundations of Research
Module 1: Foundations of ResearchModule 1: Foundations of Research
Module 1: Foundations of Research
drroxannekemp
 
COPA Apprentice exam Questions and answers PDF
COPA Apprentice exam Questions and answers PDFCOPA Apprentice exam Questions and answers PDF
COPA Apprentice exam Questions and answers PDF
SONU HEETSON
 
INQUISITORS School Quiz Prelims 2025.pptx
INQUISITORS School Quiz Prelims 2025.pptxINQUISITORS School Quiz Prelims 2025.pptx
INQUISITORS School Quiz Prelims 2025.pptx
SujatyaRoy
 
How to Share Accounts Between Companies in Odoo 18
How to Share Accounts Between Companies in Odoo 18How to Share Accounts Between Companies in Odoo 18
How to Share Accounts Between Companies in Odoo 18
Celine George
 
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptxU3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
Mayuri Chavan
 
MEDICAL BIOLOGY MCQS BY. DR NASIR MUSTAFA
MEDICAL BIOLOGY MCQS  BY. DR NASIR MUSTAFAMEDICAL BIOLOGY MCQS  BY. DR NASIR MUSTAFA
MEDICAL BIOLOGY MCQS BY. DR NASIR MUSTAFA
Dr. Nasir Mustafa
 
How to Configure Extra Steps During Checkout in Odoo 18 Website
How to Configure Extra Steps During Checkout in Odoo 18 WebsiteHow to Configure Extra Steps During Checkout in Odoo 18 Website
How to Configure Extra Steps During Checkout in Odoo 18 Website
Celine George
 
MCQ PHYSIOLOGY II (DR. NASIR MUSTAFA) MCQS)
MCQ PHYSIOLOGY II (DR. NASIR MUSTAFA) MCQS)MCQ PHYSIOLOGY II (DR. NASIR MUSTAFA) MCQS)
MCQ PHYSIOLOGY II (DR. NASIR MUSTAFA) MCQS)
Dr. Nasir Mustafa
 
Peer Assesment- Libby.docx..............
Peer Assesment- Libby.docx..............Peer Assesment- Libby.docx..............
Peer Assesment- Libby.docx..............
19lburrell
 
IMPACT_OF_SOCIAL-MEDIA- AMONG- TEENAGERS
IMPACT_OF_SOCIAL-MEDIA- AMONG- TEENAGERSIMPACT_OF_SOCIAL-MEDIA- AMONG- TEENAGERS
IMPACT_OF_SOCIAL-MEDIA- AMONG- TEENAGERS
rajaselviazhagiri1
 
INSULIN.pptx by Arka Das (Bsc. Critical care technology)
INSULIN.pptx by Arka Das (Bsc. Critical care technology)INSULIN.pptx by Arka Das (Bsc. Critical care technology)
INSULIN.pptx by Arka Das (Bsc. Critical care technology)
ArkaDas54
 
How to Manage Manual Reordering Rule in Odoo 18 Inventory
How to Manage Manual Reordering Rule in Odoo 18 InventoryHow to Manage Manual Reordering Rule in Odoo 18 Inventory
How to Manage Manual Reordering Rule in Odoo 18 Inventory
Celine George
 
LDMMIA Reiki Yoga S6 Free Workshop Money Pt 2
LDMMIA Reiki Yoga S6 Free Workshop Money Pt 2LDMMIA Reiki Yoga S6 Free Workshop Money Pt 2
LDMMIA Reiki Yoga S6 Free Workshop Money Pt 2
LDM & Mia eStudios
 
Rebuilding the library community in a post-Twitter world
Rebuilding the library community in a post-Twitter worldRebuilding the library community in a post-Twitter world
Rebuilding the library community in a post-Twitter world
Ned Potter
 
MICROBIAL GENETICS -tranformation and tranduction.pdf
MICROBIAL GENETICS -tranformation and tranduction.pdfMICROBIAL GENETICS -tranformation and tranduction.pdf
MICROBIAL GENETICS -tranformation and tranduction.pdf
DHARMENDRA SAHU
 
Ad

Sample Program file class 11.pdf

  • 1. COMPUTER SCIENCE WITH PYTHON PROGRAM FILE NAME: CLASS: SECTION:
  • 2. INDEX S.NO TOPIC T.SIGN 1 #WAP Take two integer values from user and print greatest among them. 2 A school has following rules for grading system: a. Below 25 - F b. 25 to 45 - E c. 45 to 50 - D d. 50 to 60 - C e. 60 to 80 - B f. Above 80 - A Ask user to enter marks and print the corresponding grade. 3 A company decided to give hra,da according to the foolowing criteria if his/her year of service is no of years hra da more than 5 years but less than 10 years 5% 3% more than and equal to 10 years but less than 20 years 4% 2% more than and equal to 20 years 6% 7% Ask user for their salary and year of service and print the net salary. 4 Program that demonstrate the use of Nested if- if within another if 5 Write a program to display the first 10 natural numbers. 6 Write a program to display n terms of natural number and their sum 7 Write a program to display the multiplication table of a given integer. 8 Program to demonstrate the concept of nested loop 9 Program to count all uppercase characters 10 Program to count no of vowels 11 Program to convert uppercase into lowercase and vice versa and not to use built in functions 12 Program to capitalize first and last letters of each word of a given string 13 Write a program which should change all the multiples of 5 in the list to 5 and rest of the elements as 0. 14 Write a code in python which divide all those list elements by 7 which are divisible by 7 and multiply list elements by 3. 15 Write a program in python, to add 5 in all the odd values and 10 in all the even values of the list . 16 Program to count total prime nos within the range
  • 3. 17 Write a program that creates a third tuple after adding two tuples. Add second after first tuple. 18 Program to calculate the average of the numbers of the tuple. 19 Program to store book id, book name and price of three books and store the data in dictionary name "dict" 20 Dictionary menu based Program Q1 #WAP Take two integer values from user and print greatest among them. no1=eval(input("enter no1: ")) no2=eval(input("enter no2: ")) if(no1>no2): print("no1 is greater than no2") elif(no2>no1): print("no2 is greater than no1") elif(no1==no2): print("both are equal") else: print("PLEASE ENTER VALID NO ONLY") ''' output enter no1: 3 enter no2: 4 no2 is greater than no1 '''
  • 4. Q2 A school has following rules for grading system: a. Below 25 - F b. 25 to 45 - E c. 45 to 50 - D d. 50 to 60 - C e. 60 to 80 - B f. Above 80 - A Ask user to enter marks and print the corresponding grade. sol m=int(input("enter marks")) if(m<25): print(" Grade F") elif(m>=25 and m<45): print(" Grade E") elif(m>=45 and m<50): print(" Grade D") elif(m>=50 and m<60): print(" Grade C") elif(m>=60 and m<80): print(" Grade B") elif(m>=80): #else: print(" Grade A") #-----------------OR----------------- m=int(input("enter marks")) if(m<25): print(" Grade F") elif(m<45):
  • 5. print(" Grade E") elif(m<50): print(" Grade D") elif(m<60): print(" Grade C") elif(m<80): print(" Grade B") elif(m>=80): #else: print(" Grade A") ‘’’ Output enter marks76 Grade B ‘’’
  • 6. Q3 A company decided to give hra,da according to the foolowing criteria if his/her year of service is no of years hra da more than 5 years but less than 10 years 5% 3% more than and equal to 10 years but less than 20 years 4% 2% more than and equal to 20 years 6% 7% Ask user for their salary and year of service and print the net salary. SOL n=eval(input("enter salary")) y=int(input("enter no of years")) if(y>=5 and y<10): h=n*0.05 d=n*0.03 #print("net salary",n+h+d) elif(y>=10 and y<20): h=n*0.04 d=n*0.02 #print("net salary",n+h+d) else: #elif(y>=20): h=n*0.06 d=n*0.07 #print("net salary",n+h+d) print("net salary",n+h+d) #final output related to all condition '''
  • 7. output enter salary3450 enter no of years6 net salary 3726.0 '''
  • 8. Q4 #Program that demonstrate the use of Nested if- if within another if Sol: a=int(input("enter age")) if(a<15): if(a>=0 and a<=10): print("age is between 0 to 10") else: print("age is greater than 10 but less than 15") else: print("age is greater than 15") ''' output enter age8 age is between 0 to 10 '''
  • 9. Q5 #Write a program to display the first 10 natural numbers. sol for i in range(1,11): print(i) ''' Output 1 2 3 4 5 6 7 8 9 10 ‘’’
  • 10. Q6 ''' #Write a program to display n terms of natural number and their sum ''' sol n=int(input("enter no")) s=0 for i in range(1,n+1): s=s+i print("value of natural no",i, "sum of natural no",s) ''' output enter no6 value of natural no 1 sum of natural no 1 value of natural no 2 sum of natural no 3 value of natural no 3 sum of natural no 6 value of natural no 4 sum of natural no 10 value of natural no 5 sum of natural no 15 value of natural no 6 sum of natural no 21 '''
  • 11. Q 7 ''' #Write a program to display the multiplication table of a given integer. ''' sol n=int(input("enter no")) #s=int(input("enter starting value")) #e=int(input("enter ending value")) for i in range(1,11): print(n,"x",i,"=",n*i) ''' output enter no8 8 x 1 = 8 8 x 2 = 16 8 x 3 = 24 8 x 4 = 32 8 x 5 = 40 8 x 6 = 48 8 x 7 = 56 8 x 8 = 64 8 x 9 = 72 8 x 10 = 80 '''
  • 12. Q8 # Concept of nested loop Ans #-------------------------------------- for i in range(4,0,-1): for j in range(5,i,-1): print(i,end="") print() ''' 4 33 222 1111 ''' #another program that demonstrate the use of nested loop for i in range(4): for j in range(i+1): print("*",end="") print() ''' * ** *** **** '''
  • 13. Q9 #Program to count all uppercase characters sol s=input("enter string") c=0 for i in s: if (i.isupper()): c=c+1 print(c) ''' output enter stringTHis is my file 2 ‘’’
  • 14. Q10 #Program to count no of vowels sol s=input("enter string") c=0 for i in s: if i in "aeiouAEIOU": c=c+1 print(c) ''' output enter stringthis is my file 4 '''
  • 15. Q11 # Program to display those words which are ending with capital alphabets s=input("enter string") c=0 for i in s.split(): if i[-1].isupper(): c=c+1 print(c) ''' output enter string this is mY filE 2 '''
  • 16. Q12 #Program to convert uppercase into lowercase and vice versa and not to use built in functions S="ThiS IS mY 5678 FIle" for i in S: if i>"A" and i<='Z': print(chr(ord(i)+32),end="") elif i>="a" and i<="z": print(chr(ord(i)-32),end="") ''' output tHIsisMyfiLE '''
  • 17. Q12 #Program to capitalize first and last letters of each word of a given string Sol s=input("enter string") r=" " s=s.title() for i in s.split(): r=r+i[:-1]+i[-1].upper()+" " print(r) ''' output enter stringthis is my file ThiS IS MY FilE '''
  • 18. Q13 ''' Write a program which should change all the multiples of 5 in the list to 5 and rest of the elements as 0. ''' Sol a=[2,56,78,98,90,50,45,67] for i in a: if(i%5==0): i=5 print(i,end=" ") else: i=0 print(i,end=" ") ''' output 0 0 0 0 5 5 5 0 ''' #OR a=[2,56,78,98,90,50,45,67] for i in range(len(a)): if(a[i]%5==0): a[i]=5 else: a[i]=0 print(a)
  • 19. ''' output [0, 0, 0, 0, 5, 5, 5, 0] '''
  • 20. Q14''' Write a code in python which divide all those list elements by 7 which are divisible by 7 and multiply list elements by 3. ''' Sol a=[2,56,78,98,90,50,45,67] for i in a: if(i%7==0): i=i//7 print(i,end=" ") else: i=i*3 print(i,end=" ") ''' output 6 8 234 14 270 150 135 201 ''' #OR a=[2,56,78,98,90,50,45,67] for i in range(len(a)): if(a[i]%7==0): a[i]=a[i]/7 else: a[i]=a[i]*3 print(a) ''' output [6, 8.0, 234, 14.0, 270, 150, 135, 201] '''
  • 21. Q15 ''' Write a program in python, to add 5 in all the odd values and 10 in all the even values of the list . ''' a=[2,56,78,98,90,50,45,67] for i in a: if(i%2==0): i=i+10 print(i,end=" ") else: i=i+5 print(i,end=" ") ''' output 12 66 88 108 100 60 50 72 '''
  • 22. Q16 ''' WAP to count total prime nos within the range ''' a=int(input("enter starting no")) b=int(input("enter ending limit")) c=0 d=0 for a in range(a,b+1): for i in range(2,a): if(a%i==0): c=c+1 break else: d=d+1 print("total not prime no",c) print("total prime",d) ''' output enter starting no5 enter ending limit19 total not prime no 9 total prime 6 '''
  • 23. Q17 ‘’’ WAP that creates a third tuple after adding two tuples. Add second after first tuple. ‘’’ a=(1,2,3) b=(4,5,6) c=a+b print(c) ‘’’ Output (1,2,3,4,5,6) ‘’’
  • 24. Q18 ‘’’ WAP to calculate the average of the numbers of the tuple. ‘’’ t=eval(input("enter tuple")) l=len(t) a=0 s=0 for i in range(0,l): s=s+t[i] a=s/l print("average of given tuple",a) ''' output enter tuple1,2,3,4 average of given tuple 2.5 '''
  • 25. Q19 ''' WAP to store book id, book name and price of three books and store the data in dictionary name "dict" ''' dict={} for i in range(3): b_id=int(input("enter book id:")) b_name=input("enter book name:") b_price=int(input("enter price of book:")) dict[b_id]=b_name,b_price print(dict) ''' OUTPUT enter book id:1 enter book name:abc enter price of book:450 enter book id:2 enter book name:cs with python enter price of book:279 enter book id:3 enter book name:cs with c++ enter price of book:350 {1: ('abc', 450), 2: ('cs with python', 279), 3: ('cs with c++', 350)} '''
  • 26. Q20 ‘’’ Dictionary Menu Based ‘’’ a=0 while a!=1: print("1. add information") print("2. display all information") print("3. search a particular info") print("4. delete a particular info") print("5. modification a particular info") print("6. exit") ch=int(input("enter your choice")) d={} if(ch==1): n=int(input("how many elements u want to enter")) for i in range(n): r=input("enter rollno") n=input("enter name") m=int(input("enter marks")) d[r]=n,m print(d) elif(ch==2): for i in d: print(i,d[i]) elif(ch==3): s=input("enter the key which u want to search") for i in d: if(i==s):
  • 27. print(d[i]) elif(ch==4): s=input("enter the key which u want to search") for i in d: if(i==s): d.pop(s) print(d) elif(ch==5): s=input("enter the key which u want to search") v=int(input("enter the value")) d[s]=v print(d) elif(ch==6): a=1 ‘’’ output 1. add information 2. display all information 3. search a particular info 4. delete a particular info 5. modification a particular info 6. exit enter your choice1 how many elements u want to enter3 enter rollno1 enter namereena enter marks70 enter rollno2
  • 28. enter nameteena enter marks80 enter rollno3 enter namesheena enter marks89 {'1': ('reena', 70), '2': ('teena', 80), '3': ('sheena', 89)} 1. add information 2. display all information 3. search a particular info 4. delete a particular info 5. modification a particular info 6. exit enter your choice3 enter the key which u want to search1 ('reena', 70) 1. add information 2. display all information 3. search a particular info 4. delete a particular info 5. modification a particular info 6. exit enter your choice5 enter the key which u want to modify3 enter namemeena enter marks97 after modification dictionary is {'1': ('reena', 70), '2': ('teena', 80), '3': ('meena', 97)} 1. add information 2. display all information 3. search a particular info
  • 29. 4. delete a particular info 5. modification a particular info 6. exit enter your choice4 enter the key which u want to delete2 after deletion dictionary is {'1': ('reena', 70), '3': ('meena', 97)} 1. add information 2. display all information 3. search a particular info 4. delete a particular info 5. modification a particular info 6. exit enter your choice6 ‘’’
  翻译: