0% found this document useful (0 votes)
290 views18 pages

Cbse Class 12 Maths Project

This document is a computer science practical file submitted by Harivansh Sharma, a class 12 student. It contains 15 Python programs with outputs and 5 SQL queries with outputs. It has certificates signed by the teacher and principal to certify that Harivansh has completed the project. It also includes an acknowledgement thanking the teacher and principal for providing the opportunity and guidance for the project.

Uploaded by

RAJ ROY
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)
290 views18 pages

Cbse Class 12 Maths Project

This document is a computer science practical file submitted by Harivansh Sharma, a class 12 student. It contains 15 Python programs with outputs and 5 SQL queries with outputs. It has certificates signed by the teacher and principal to certify that Harivansh has completed the project. It also includes an acknowledgement thanking the teacher and principal for providing the opportunity and guidance for the project.

Uploaded by

RAJ ROY
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/ 18

DEDRAJ SEWALI DEVI

TODI DAV-KVB SCHOOL 

                                             

              COMPUTER SCIENCE  


                     PRACTICAL FILE 
  

 
TOPIC: PYTHON PROGRAM AND  
              SQL  QUERIES 
SESSION: 2020-2021 

SUBMITTED BY:HARIVANSH SHARMA


CLASS: XII 
ROLL NO:
  
  
  
 
  
CERTIFICATE 
This is to certify that HARIVANSH SHARMA has successfully completed this
project report entitled “Python program and SQL queries”. during the academic
year 2020-2021 towards partial fulfillment of computer science practical
examination conducted by CBSE. 
  
  
  
  
  
  
  

-------------------                           --------------------
Teacher's signature                           Principal's signature 
                                  
                                ----------------------- 
                   External Invigilator's Signature 
 
 
  ACKNOWLEDGEMENT 
I would like to express my special thanks of gratitude to my teacher Ashish Ashk
as well as our principal R.K.Mishra who gave me the golden opportunity to do this
wonderful project on the topic “Python program and SQL queries “, which also
helped me in doing a lot of Research and I came to know about so many new
things I am really thankful to them. 

 
TABLE OF CONTENTS 
 

 
A. 15 Python programs with output 
 
B. 5 SQL queries with output 
 
 
 
 
 
# PYTHON PROGRAM WITH OUTPUT
1.Write a Python program to print the calendar of a given month and year.

import calendar

y = int(input("Input the year : "))

m = int(input("Input the month : "))

print(calendar.month(y, m))

output:

2. Write a Python program to calculate number of days between two dates.


from datetime import date
f_date = date(2014, 7, 2)
l_date = date(2014, 7, 11)
delta = l_date - f_date
print(delta.days)

output:
3. Python3 program to add two numbers
  
num1 = 15
num2 = 12
sum = num1 + num2
  print("Sum of {0} and {1} is {2}" .format(num1, num2, sum))
output:

4. Write a Python program to convert all units of time into seconds.

days = int(input("Input days: ")) * 3600 * 24


hours = int(input("Input hours: ")) * 3600
minutes = int(input("Input minutes: ")) * 60
seconds = int(input("Input seconds: "))
time = days + hours + minutes + seconds

print("The amounts of seconds", time)

output:
5. Write a Python program to concatenate all elements in a list into a string and
return it.

def concatenate_list_data(list):

result= ''
for element in list:
result += str(element)
return result

print(concatenate_list_data([1, 5, 12, 2]))

6. Write a Python program to display your details like name, age, address in
three different lines.

def personal_details():
name, age = "harivansh",16
address = "Biratnagar,morang,nepal"
print("Name: {}\nAge: {}\nAddress: {}".format(name, age, address))

personal_details()

output:
7. Write a Python program to compute the distance between the points (x1, y1)
and (x2, y2).

import math
p1 = [4, 0]
p2 = [6, 6]
distance = math.sqrt( ((p1[0]-p2[0])**2)+((p1[1]-p2[1])**2) )

print(distance)

8. Write a Python program to calculate the hypotenuse of a right angled triangle.

from math import sqrt


print("Input lengths of shorter triangle sides:")
a = float(input("a: "))
b = float(input("b: "))

c = sqrt(a**2 + b**2)
print("The length of the hypotenuse is", c )

output:
9. Write a Python program to convert the distance (in feet) to inches, yards, and
miles.

d_ft = int(input("Input distance in feet: "))


d_inches = d_ft * 12
d_yards = d_ft / 3.0
d_miles = d_ft / 5280.0

print("The distance in inches is %i inches." % d_inches)


print("The distance in yards is %.2f yards." % d_yards)
print("The distance in miles is %.2f miles." % d_miles)

10. Write a Python program to test whether a passed letter is a vowel or not.

def is_vowel(char):
all_vowels = 'aeiou'
return char in all_vowels
print(is_vowel('c'))
print(is_vowel('e'))
11. Write a Python program to convert seconds to day, hour, minutes and
seconds.
time = float(input("Input time in seconds: "))
day = time // (24 * 3600)
time = time % (24 * 3600)
hour = time // 3600
time %= 3600
minutes = time // 60
time %= 60
seconds = time
print("d:h:m:s-> %d:%d:%d:%d" % (day, hour, minutes, seconds))

output:

12. Write a Python program to calculate body mass index.

height = float(input("Input your height in meters: "))


weight = float(input("Input your weight in kilogram: "))
print("Your body mass index is: ", round(weight / (height * height),
2))

output:
13. Write a Python program to get the ASCII value of a character.

print()

print(ord('a'))

print(ord('A'))

print(ord('1'))

print(ord('@'))

print()

output:

14. Write a Python program to remove the first item from a specified list.
color = ["Red", "Black", "Green", "White", "Orange"]
print("\nOriginal Color: ",color)
del color[0]
print("After removing the first color: ",color)
print()
output:
15. Python Program for factorial of a number
def factorial(n):
    if n < 0:
        return 0
    elif n == 0 or n == 1:
        return 1
    else:
        fact = 1
        while(n > 1):
            fact *= n
            n -= 1
        return fact
  
# Driver Code
num = 5;
print("Factorial of",num,"is",
factorial(num))
output:
# SQL COMMANDS
DEDRAJ SEWALI DEVI
TODI DAV-KVB SCHOOL 

                                             

              COMPUTER SCIENCE  


                     PROJECT FILE 
  

 
TOPIC: BANK MANAGEMENT SYSTEM

SESSION: 2020-2021 
SUBMITTED BY:HARIVANSH SHARMA
CLASS : XII 
ROLL NO:
  
  
  
 
  
CERTIFICATE 
This is to certify that HARIVANSH SHARMA has successfully completed this
project report entitled “BANK MANAGEMENT SYSTEM”. during the
academic year 2020-2021 towards partial fulfillment of computer science practical
examination conducted by CBSE. 
  
  
  
  
  
  
  

-------------------                           --------------------
Teacher's signature                           Principal's signature 
                                  
                                ----------------------- 
                   External Invigilator's Signature 
 
 
  ACKNOWLEDGEMENT 
I would like to express my special thanks of gratitude to my teacher Ashish Ashk
as well as our principal R.K.Mishra who gave me the golden opportunity to do this
wonderful project on the topic “BANK MANAGEMENT SYSTEM”, which also
helped me in doing a lot of Research and I came to know about so many new
things I am really thankful to them. 

You might also like