Sunday, 14 November 2021

To find average and grade for given marks.


sub1=int(input("Enter marks of the first subject: "))

sub2=int(input("Enter marks of the second subject: "))
sub3=int(input("Enter marks of the third subject: "))
sub4=int(input("Enter marks of the fourth subject: "))
sub5=int(input("Enter marks of the fifth subject: "))
avg=(sub1+sub2+sub3+sub4+sub4)/5
if(avg>=90):
    print("Grade: A")
elif(avg>=80&avg<90):
    print("Grade: B")
elif(avg>=70&avg<80):
    print("Grade: C")
elif(avg>=60&avg<70):
    print("Grade: D")
else:
    print("Grade: F")

Monday, 20 September 2021

11th CS Python Practical List

1. Input two numbers and display the larger / smaller number. click here 

2.  Input three numbers and display the largest / smallest number. click here 

3 Generate the following patterns using nested loop. Click here

  3A Pattern-1

 *

 **

 ***

 **** 

 ***** 

 Pattern-2

1 2 3 4 5

 1 2 3 4

 1 2 3

 1 2

 1 

Pattern-3

 A 

AB

 ABC 

ABCD 

ABCDE 

4 Write a program to input the value of x and n and print the sum of the
  series: 1+x+x^2+x^3+x^4+ ............x^n  click here  

5. Write a program to input the value of x and n and print the sum of the
  series: 1-x+x^2-x^3+x^4 + ......... x^n  click here

6. Write a program to input the value of x and n and print the sum of the
  series: x + x^2/2 - x^3/3 + x^4/4 + ........... x^n/n  click here   

 7. Determine whether a number is a perfect number, an armstrong number or a
palindrome. click here 

8. Input a number and check if the number is a prime or composite number. click here 

9. Display the terms of a Fibonacci series. click here  

10. Compute the greatest common divisor and least common multiple of two
integers. click here  Date: 

11. Count and display the number of vowels, consonants, uppercase, lowercase
characters in string. click here  Date: 

12.. Input a string and determine whether it is a palindrome or not; convert the
case of characters in a string. click here  Date:

13. Find the largest/smallest number in a list/tuple click here  Date

14, Input a list of numbers and swap elements at the even location with the
elements at the odd location. click here Date: 


15. Input a list/tuple of elements, search for a given element in the list/tuple. click here  Date:

 
16. Create a dictionary with the roll number, name and marks of n students in a
class and display the names of students who have marks above 75. click here





Friday, 3 September 2021

11th IP Python Practical list



Programming in Python 

1. To find average and grade for given marks. Click Here

 2. To find the sale price of an item with a given cost and discount (%). Click Here

3. To calculate perimeter/circumference and area of shapes such as triangle, rectangle, square and circle. Click Here

 4. To calculate Simple and Compound interest. Click Here

5. To calculate profit-loss for a given Cost and Sell Price. Click Here

6. To calculate EMI for Amount, Period and Interest. Click Here

 7. To calculate tax - GST / Income Tax. Click Here

8. To find the largest and smallest numbers in a list. Click Here

 9. To find the third largest/smallest number in a list. Click Here

 10. To find the sum of squares of the first 100 natural numbers. Click Here

11. To print the first ‘n’ multiples of a given number. Click Here

12. To count the number of vowels in a user entered string.  Click Here

 13. To print the words starting with a particular alphabet in a user entered string.  Click Here

14. To print the number of occurrences of a given alphabet in a given string.  Click Here

15. Create a dictionary to store names of states and their capitals.  Click Here video click here

16. Create a dictionary of students to store names and marks obtained in 5 subjects.  Click Here video click here

 17. To print the highest and lowest values in the dictionary.  Click Here  video click here


    MySQL/SQL programme0 
     01. SQL Queries- one table / two tables.  Click Here

     02. SQL Queries – one table / two tables. Click Here 


Friday, 23 July 2021

read, write/create, search, append, update & delete methods in Binary file 

 

Program




































































Output






































































program

#Menu Driven program to perform all the operations

#on a Binary file....

import pickle

def write():

    f=open("StudentDetails.dat","wb")

    record=[]

    while True:

        rno=int(input("Roll No:"))

        name=input("Name:")

        marks=int(input("Marks:"))

        data=[rno,name,marks]

        record.append(data)

        ch=input("More(Y/N)?")

        if ch in 'Nn':

            break

    pickle.dump(record,f)

    print("Record Added..")

    f.close()


def read():

    print("Contents in a File...")

    f=open("StudentDetails.dat","rb")

    try:

        while True:

            s=pickle.load(f)

            print(s)

            for i in s:

                print(i)

    except Exception:

        f.close()


def append():

    f=open("StudentDetails.dat","rb+")

    print("Append data in a File..")

    Rec=pickle.load(f)

    while True:

        rno=int(input("Roll No:"))

        name=input("Name:")

        marks=int(input("Marks:"))

        data=[rno,name,marks]

        Rec.append(data)

        ch=input("More(Y/N)?")

        if ch in 'Nn':

            break

    f.seek(0)

    pickle.dump(Rec,f)

    print("Record Appended..")

    f.close()

            

def search():

    f=open("StudentDetails.dat","rb")

    r=int(input("Enter roll no to be searched:"))

    found=0

    try:

        while True:

            s=pickle.load(f)

            for i in s:

                if i[0]==r:

                    print(i)

                    found=1

                    break

    except EOFError:

        f.close()

    if found==0:

        print("Sorry...No record Found..")


def update():

    f=open("StudentDetails.dat","rb+")

    r=int(input("Enter roll no whose details to be updated:"))

    f.seek(0)

    try:

        while True:

            rpos=f.tell()

            s=pickle.load(f)

            print(s)

            for i in s:

                if i[0]==r:

                    i[1]=input("New Name:")

                    i[2]=int(input("Updated Marks:"))

                    f.seek(rpos)

                    pickle.dump(s,f)

                    break

    except Exception:

        f.close()

                

def delete():

    f=open("StudentDetails.dat","rb")

    s=pickle.load(f)

    f.close()

    r=int(input("Enter roll no to be deleted:"))

    f=open("StudentDetails.dat","wb")

    print(s)

    reclst=[]

    for i in s:

        if i[0]==r:

            continue

        reclst.append(i)

    pickle.dump(reclst,f)

    f.close()

        

#MainMenu

print("---------------------------------------------------")

print("1.Write Data in a Binary File..")

print("2.Read Data from a File..")

print("3.Append data in a File..")

print("4.Search Operation in a File..")

print("5.Update Data in a File..")

print("6.Delete Operation in a File..")

print("7.Exit..")

print("---------------------------------------------------")


while True:

    ch=int(input("Enter your choice:"))

    if ch==1:

        write()

    elif ch==2:

        read()

    elif ch==3:

        append()

    elif ch==4:

        search()

    elif ch==5:

        update()

    elif ch==6:

        delete()

    elif ch==7:

        break

                   

    



Sunday, 27 June 2021

12th class Python Program list 2021-22

                                    As per CBSE Practical List 2021-22

Term-1

 1. Read a text file line by line and display each word separated by a #.                             click here  Date:22-06-2021 

2. Read a text file and display the number of                                                                   vowels/consonants/uppercase/lowercase characters in the file.                                           Click here  Date:29-06-2021

3. Remove all the lines that contain the character 'a' in a file and write it to another file. Click here  Date:06-07-2021 

4. Create a binary file with name and roll number. Search for a given roll number and display the name, if not found display appropriate message.                                                    Click here  Date:13-07-2021

5. Create a binary file with roll number, name and marks. Input a roll number and update the marks. Click here Date:20-07-2021

 6. Write a random number generator that generates random numbers between 1 and 6 (simulates a dice). Click here Date: 27-07-2021

7. Write a Python program with function to count the number of lines in a text file ‘ 'STORY.TXT’ which is starting with an alphabet ‘A’ or 'a'.                                                                     Click here   date : 04-08-21

8. Write a Python program with method/function DISPLAYWORDS() to read lines from a text file STORY.TXT, and display those words, which are less than 4 characters.   Click Here  date : 11-08-21

9. Text Files Menu Driven Program: Click Here  date : 19-08-21

 Choice = 1. Read a text file line by line and display each word             

         separated by a '#'. 
           Choice = 2.Python program with function to count the number of lines 
              in a text file ‘ 'STORY.TXT’ which is starting with an alphabet ‘A’ or 'a'.
                Choice= 3. Python program with method/function DISPLAYWORDS() 
                  to read lines from a text file STORY.TXT, and display those words, 
                     which are less than 4 characters.

                  10. Text Files Menu Driven Program: Click Here  date: 26-08-21
                   Choice= 1. Remove all the lines that contain the character `a’ in a file and write it to another file. 
                    Choice= 2. Read a text file and display the number of vowels/                        consonants/ uppercase/ lowercase characters in the file.                                            

                    11. Create a CSV file by entering user-id and Password, read and search the password for given user-id.  Click here date: 04-09-21
                        12. Write a program to input the value of x and n and print the sum of the
                        series: x + x^2/2! - x^3/3! + x^4/4! + ............ x^n/n! click here   Date: 11-09-21

                        13. Determine whether a number is a perfect number, an armstrong number or a  palindrome.               click here  Date: 18-09-21 
                        14. Input a number and check if the number is a prime or composite number.                                       click here   Date: 23-09-21 
                        15. Display the terms of a Fibonacci series.         click here  Date: 30-09-21

                        Term-2
                        Data Structure

                        01 Stack Program 1 Write a python program to implement a stack using a list data-structure. Click Here (Reference Video: Click Here)   

                        02. Stack Program 2 Write a menu based python program to implement the the operations insert, delete, peek and display on stack(Member number, Member Name and Age).   Click Here
                         

                        03. Stack based program 3 Write a Python Program to implement a Stack for the book details (bookno,bookname). That is, each item node of the stack contains two types of information- a book number and its name. Implement all the operations of Stack.    Click Here

                        04. Write a Python program to implement a queue using a list data-structure.    Click Here    

                        05. Python Program for Binary Search( Iterative method) Click here


                        MySQL/SQL programmes

                        06. SQL Queries:-1 – Minimum 5 sets using one table / two tables. Click Here 

                        07. SQL Queries:-2 – Minimum 5 sets using one table / two tables. Click Here  

                        08. SQL Queries:-3- Create the following student table and answer the following queries. Click Here

                        Connectivity Programmes (Mysql with Python)

                        09. Find the total number of customers from each country in the table (customer ID, customer name, country) using group by( python interface through MYSQL). Click Here

                        10. INSERT, UPDATE, AND DELETE (PYTHON INTERFACE THROUGH MYSQL)ppt slides(RKS):ClickHer​e and Reference: INSERT, UPDATE, AND DELETE (PYTHON INTERFACE THROUGH  MYSQL)video: Click Here