Saturday, 24 August 2019

KV HEBBAL EXAMINATION


* Class 11th  Progress Report Card(down load): Click Here

* Class 9th  Progress Report Card(down load): Click Here

* Class 3rd and 8th Progress Report Card(down load): Click Here

* Class 1st and 2nd Progress Report Card(down load):  Click Here

Monday, 19 August 2019

12TH CS AUGUST MONTHLY TEST 2019-20 BLUEPRINT


I. DATA VISUALIZATION (PYPLOT)  (17 MARKS) 

  1. Line chart-5 marks
  2. Bar chart-5 marks
  3. Pie Chart-5 marks
  4. Direct question -2 marks

II .DATA STRUCTURE (18 MARKS)

1. List- 5 marks
2. stack – 5 marks
3. Queue- 5 marks
4.Direct Questions  – 3 marks






Wednesday, 7 August 2019

Prog-10 Write a Python program to implement a Queue using a list data-structure.


class Queue:
    def __init__(self):
        self.items = []
    def isEmpty(self):
        return self.items == []
    def enqueue(self, item):
        self.items.insert(0,item)
    def dequeue(self):
        return self.items.pop()
    def size(self):
        return len(self.items)
 
q = Queue()
while True:
    print('Press 1 for insert')
    print('Press 2 for delete')
    print('Press 3 for quit')
    do = int(input('What would you like to do'))
    if do == 1:
        n=int(input("enter a number to push"))
        q.enqueue(n)
    elif do == 2:
        if q.isEmpty():
            print('Queue is empty.')
        else:
            print('Deleted value: ', q.dequeue())
    elif do == 3:
        break


Input and Output

Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:06:47) [MSC v.1914 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>>
 RESTART: C:/Users/Student/AppData/Local/Programs/Python/Python37-32/qrks.py

Press 1 for insert
Press 2 for delete
Press 3 for quit
What would you like to do1
enter a number to push5
Press 1 for insert
Press 2 for delete
Press 3 for quit
What would you like to do1
enter a number to push2
Press 1 for insert
Press 2 for delete
Press 3 for quit
What would you like to do1
enter a number to push10
Press 1 for insert
Press 2 for delete
Press 3 for quit
What would you like to do 2
Deleted value:  5
Press 1 for insert
Press 2 for delete
Press 3 for quit
What would you like to do 2
Deleted value:  2
Press 1 for insert
Press 2 for delete
Press 3 for quit
What would you like to do 2
Deleted value:  10
Press 1 for insert
Press 2 for delete
Press 3 for quit
What would you like to do 2
Queue is empty.
Press 1 for insert
Press 2 for delete
Press 3 for quit
What would you like to do 2
Queue is empty.
Press 1 for insert
Press 2 for delete
Press 3 for quit
What would you like to do 3
>>>


Explaination:

self 

The word 'self' is used to represent the instance of a class. By using the "self" keyword we access the attributes and methods of the class in python.

__init__ method

"__init__" is a reseved method in python classes. It is called as a constructor in object oriented terminology. This method is called when an object is created from a class and it allows the class to initialize the attributes of the class.
Find out the cost of a rectangular field with breadth(b=120), length(l=160). It costs x (2000) rupees per 1 square unit
class Rectangle:
   def __init__(self, length, breadth, unit_cost=0):
       self.length = length
       self.breadth = breadth
       self.unit_cost = unit_cost
   def get_area(self):
       return self.length * self.breadth
   def calculate_cost(self):
       area = self.get_area()
       return area * self.unit_cost
# breadth = 120 units, length = 160 units, 1 sq unit cost = Rs 2000
r = Rectangle(160, 120, 2000)
print("Area of Rectangle: %s sq units" % (r.get_area()))
This gives the output
Area of Rectangle: 19200 sq units
Cost of rectangular field: Rs.38400000

Tuesday, 6 August 2019

Prog-9 Write a Python program to implement a stack using a list data-structure.


class Stack:
    def __init__(self):
        self.items = []
    def is_empty(self):
        return self.items == []
    def push(self, data):
        self.items.append(data)
    def pop(self):
        return self.items.pop()
 
s = Stack()
while True:
    print('Press 1 for push')
    print('Press 2 for pop')
    print('Press 3 for quit')
    do = int(input('What would you like to do'))
    if do == 1:
        n=int(input("enter a number to push"))
        s.push(n)
    elif do == 2:
        if s.is_empty():
            print('Stack is empty.')
        else:
            print('Popped value: ', s.pop())
    elif do == 3:
        break


Output:

What would you like to do 1
enter a number to push 5
Press 1 for push
Press 2 for pop
Press 3 for quit
What would you like to do 1
enter a number to push 3
Press 1 for push
Press 2 for pop
Press 3 for quit
What would you like to do 1
enter a number to push 6
Press 1 for push
Press 2 for pop
Press 3 for quit
What would you like to do 2
Popped value:  6
Press 1 for push
Press 2 for pop
Press 3 for quit
What would you like to do 2
Popped value:  3
Press 1 for push
Press 2 for pop
Press 3 for quit
What would you like to do 2
Popped value:  5
Press 1 for push
Press 2 for pop
Press 3 for quit
What would you like to do 2
Stack is empty.
Press 1 for push
Press 2 for pop
Press 3 for quit
What would you like to do 2
Stack is empty.
Press 1 for push
Press 2 for pop
Press 3 for quit
What would you like to do 3
>>> 

School Website


* KVS New Website/Get Updates Directly to Your Email /My Review on New Websites: Click Here

* How to upload Photo Banner on New KVS Website(8 min): Click Here

Friday, 2 August 2019

8. Write a random number generator that generates random numbers between 1 and 6 (simulates a dice).

def random():
    import random
    s=random.randint(1,6)
    return s
print(random()) 

output

5
4
3

Write a Python program to plot the function y = x2 using the pyplot or matplotlib libraries.


import matplotlib.pyplot as pl
lstx=[]
lsty=[]
num = int(input('How many numbers: '))
for i in range(num):
    x = int(input('Enter number '))
    lstx.append(x)
    y=x**2
    lsty.append(y)
pl.plot(lstx,lsty)
pl.show()

Input

How many numbers: 3
Enter number 1
Enter number 2
Enter number 3