es
Feedback
CBSE COMPUTER SCIENCE

CBSE COMPUTER SCIENCE

Ir al canal en Telegram

QUESTION BANK, REFERENCE BOOK, LAB MANUAL , WORKSHEET ETC., PYTHON TEXT BOOK AND REFERENCE BOOKS, 01. ASK QUESTIONS AT https://t.me/joinchat/FJ1noGs-64I0OWI1

Mostrar más
549
Suscriptores
Sin datos24 horas
Sin datos7 días
Sin datos30 días
Archivo de publicaciones
#Searching a Record import mysql.connector as mcr cn = mcr.connect(host='127.0.0.1',user='root',password="admin",database="company") cr = cn.cursor() print("#"*40) print(" EMPLOYEE SEARCHING FORM") print("#"*40) ans='Y' while ans.lower()=='y': eno = int(input("ENTER EMPNO TO SEARCH :")) query="select * from employee where empno={}".format(eno) cr.execute(query) result = cr.fetchall() if cr.rowcount==0: print("Sorry! Empno not found ") else: print("%10s"%"EMPNO", "%20s"%"NAME","%15s"%"DEPARTMENT","%10s"%"SALARY") for row in result: print("%10s"%row[0],"%20s"%row[1],"%15s"%row[2],"%10s"%row[3]) ans=input("SEARCH MORE (Y/N) :")

import mysql.connector as mcr cn = mcr.connect(host='127.0.0.1',user='root',password="admin") cr = cn.cursor() cr.execute("create database if not exists company") cr.execute("use company") cr.execute("create table if not exists employee(empno int, name varchar(20), dept varchar(20),salary int)") cn.commit() choice=None while choice!=0: print("1. ADD RECORD ") print("2. DISPLAY RECORD ") print("0. EXIT") choice = int(input("Enter Choice :")) if choice == 1: e = int(input("Enter Employee Number :")) n = input("Enter Name :") d = input("Enter Department :") s = int(input("Enter Salary :")) query="insert into employee values({},'{}','{}',{})".format(e,n,d,s) cr.execute(query) cn.commit() print("## Data Saved ##") elif choice == 2: query="select * from employee" cr.execute(query) result = cr.fetchall() print("%10s"%"EMPNO","%20s"%"NAME","%10s"%"DEPARTMENT","%15s"%"SALARY") for row in result: print("%10s"%row[0],"%20s"%row[1],"%10s"%row[2],"%15s"%row[3]) elif choice==0: cn.close() print("## Bye!! ##") else: print("## INVALID CHOICE ##")

#Program to read content of file #and display total number of vowels, consonants, lowercase and uppercase characters f = open("file1.txt") v=0 c=0 u=0 l=0 o=0 data = f.read() vowels=['a','e','i','o','u'] for ch in data: if ch.isalpha(): if ch.lower() in vowels: v+=1 else: c+=1 if ch.isupper(): u+=1 elif ch.islower(): l+=1 elif ch!=' ' and ch!='\n': o+=1 print("Total Vowels in file :",v) print("Total Consonants in file n :",c) print("Total Capital letters in file :",u) print("Total Small letters in file :",l) print("Total Other than letters :",o) f.close()

import mysql.connector as mcr cn = mcr.connect(host='127.0.0.1',user='root',password="admin") cr = cn.cursor() cr.execute("create database if not exists company") cr.execute("use company") cr.execute("create table if not exists employee(empno int, name varchar(20), dept varchar(20),salary int)") cn.commit() choice=None while choice!=0: print("1. ADD RECORD ") print("2. DISPLAY RECORD ") print("0. EXIT") choice = int(input("Enter Choice :")) if choice == 1: e = int(input("Enter Employee Number :")) n = input("Enter Name :") d = input("Enter Department :") s = int(input("Enter Salary :")) query="insert into employee values({},'{}','{}',{})".format(e,n,d,s) cr.execute(query) cn.commit() print("## Data Saved ##") elif choice == 2: query="select * from employee" cr.execute(query) result = cr.fetchall() print("%10s"%"EMPNO","%20s"%"NAME","%10s"%"DEPARTMENT","%15s"%"SALARY") for row in result: print("%10s"%row[0],"%20s"%row[1],"%10s"%row[2],"%15s"%row[3]) elif choice==0: cn.close() print("## Bye!! ##") else: print("## INVALID CHOICE ##")

12TH-CBSE-COMPUTER SCIENCE LAB PROGRAMS-PART-3

PRACTICAL PROGRAMS - PART -1

Enter the number of students whose data to be stored: 3 Enter the Roll number of the Student : 101 Enter the Name of the Student : APPLE Enter a mark of the Student :35 Enter the Roll number of the Student : 102 Enter the Name of the Student : ORANGE Enter a mark of the Student :78 Enter the Roll number of the Student : 103 Enter the Name of the Student : MANGO Enter a mark of the Student :50 STUDENT DETAIL 101 . ('APPLE', 35) 102 . ('ORANGE', 78) 103 . ('MANGO', 50) List of students those who are scoring more than 75 Marks 102 . ('ORANGE', 78) >>>

#Program to create a dictionary which stores rollno,name and marks of the student #list out students those who are scoring more than 75 Marks num = int(input("Enter the number of students whose data to be stored: ")) count = 1 stud = dict() #create an empty dictionary while count <= num: Roll= int(input("Enter the Roll number of the Student : ")) Name = (input("Enter the Name of the Student : ")) M1=int(input("Enter a mark of the Student :")) stud[Roll]=(Name,M1) count += 1 print("\n\nSTUDENT DETAIL") for k in stud: print(k,'.',stud[k]) print("List of students those who are scoring more than 75 Marks ") for k,v in stud.items() : if v[1]>=75: print(k,'.',stud[k])

CBSE-12TH-LAB PROGRAMS-PART-2

CBSE-12TH-LAB PROGRAMS- PART-I

Computer Science with Python - Supplementary

Sample Question Paper - 2

Sample Question Paper - 1