Year 9

Term 3

Unit - 5 Programming in Python

# This program prints Hello, world!
print('Hello, world!')
# This program adds two numbers

num1 = 1.5
num2 = 6.3

# Add two numbers
sum = num1 + num2

# Display the sum
print('The sum of num1 and num2 is ',sum)

 

# Store input numbers
num1 = input('Enter first number: ')
num2 = input('Enter second number: ')

# Add two numbers
sum = float(num1) + float(num2)

# Display the sum
print('The sum of num1 and num2 is ',sum)

 

a = float(input('Enter first side: '))
b = float(input('Enter second side: '))
c = float(input('Enter third side: '))

s = (a + b + c) / 2

area = (s*(s-a)*(s-b)*(s-c)) ** 0.5
print('The area of the triangle is ' ,area)

 

x = input('Enter value of x: ')
y = input('Enter value of y: ')

print('The value of x before swapping: ',x)
print('The value of y before swapping: ',y)

temp = x
x = y
y = temp

print('The value of x after swapping: ',x)
print('The value of y after swapping: ',y)

 

print("Enter the Principle Amount: ")
p = int(input())
print("Enter Rate of Interest (%): ")
r = float(input())
print("Enter Time Period: ")
t = float(input())
si = (p*r*t)/100
print("Simple Interest Amount: ")
print(si)

 

pi = 3.14
diameter = int(input("enter the diameter of the circle"))
radius = diameter / 2
perimeter = 2 * pi * radius
print("perimeter of circle is ", perimeter)

 

num = int(input("enter the number : "))
if(num%2==0):
 print("It is Even number")
else:
 print("It is Odd number")

 

 

age = int(input("enter the age : "))
if(age>=18):
 print("You can vote")
else:
 print("You can't vote")

 

pi = 3.14
radius = int(input("enter the radius of the circle"))
area = pi * radius * radius
print("area of circle is ", area)

 

kilometers = float(input("Enter value in kilometers: ")) conv_fac = 0.621371 
miles = kilometers * conv_fac 
print("kilometers is equal to miles",miles))

 

b=float(input("Enter the base of triangle"))
h=float(input("Enter the height of triangle"))
Area=(1/2)*b*h
print("The area of triangle is : ", Area)

 

a = float(input("Enter the dividend : "))
b = float(input("Enter the divisor : "))
Q = a // b
R = a % b
print("The quotient is : ", Q)
print("The remainder is : ", R)

 

a=int(input('Enter the first integer:'))
b=int(input('Enter the second integer:'))
c=int(input('Enter the third integer:'))

if a>b and a>c:
 print(a, 'is the largest integer')
elif b>c:
 print(b, 'is the largest integer')
else:
 print(c, 'is the largest integer')

Unit - 6 Databases - SQL

A database, SOFASELECT, was set up to show the prices of suites, sofas and chairs for sale from an online furniture warehouse. Part of the database is shown below:

  1. Write SQL query to create the table SOFASELECT and enter the records.
  2. Write SQL query to show the brochure number, material, colour and price of all the furniture with 3 or more seats.
  3. Write SQL query to show the Description, Price and Colour of all the items of price less 1000
  4. Write SQL query to show all the items of Leather Material.

A wildlife park has a database table, called LIVESTOCK, to classify and record its animal species. Part of the database table is shown.

  1. Write SQL query to create table LIVESTOCK and enter the records.
  2. Write SQL query to display the record of all the Mammals.
  3. Write SQL query to display Species and Diet of animals with only 2 legs.
  4. Write SQL query to display a list of all four legged mammals that are herbivores, sorted alphabetically by species, with only the species displayed.

6 A database table, JUICE, is used to keep a record of cartons of fresh fruit juice available for sale.

 

  1. Write SQL query to create table JUICE and enter the records.
  2. Complete the SQL query to display only the stock level and size of all cartons containing only apple juice.
  3. Write the SQL query to display the items with Stock less than 10.
  4. Write SQL query to display Juice code and Stock of all Large Size items. 

A database table, TREES, is used to keep a record of the trees in a park. Each tree is given a unique number and is examined to see if it is at risk of dying. There are over 900 trees; part of the database table is shown.

  1. Write SQL query to create table TREES and enter the records.
  2. Write SQL query to display the those trees who are not at risk.
  3. Write a query to identify at risk trees over 100 years old. Display only the type and the position on the map.

A database was set up to show the properties of certain chemical elements. Part of the database is shown below.

  1. Write SQL query to create table CHEMICAL and enter the records.
  2. Write SQL query to display Name of the element, Atomic weight and Atomic number of the elements with negative Melting point.
  3. Display the element symbol with state at room temperature is solid.