Skip to main content

Posts

Showing posts from April, 2025

MYSQL-PYTHON CONNECTIVITY - PRACTICE QUESTIONS

  GRADE - XII MYSQL-PYTHON CONNECTIVITY PRACTICE QUESTIONS 1. Write the code to check whether the database has been created or not using Python interface. 2. Write a code to create a table ‘student’ inside the database ‘school’ using Python as the interface. 3. Write the code to insert multiple records into the table student through Python interface. 4. How can we display all the records of a student table in Python? 5. Write the code to display all the records along with the total number of records from the student table using Python shell.

PYTHON - MYSQL CONNECTIVITY CODE

  #INSERTION OF DATA import mysql.connector mydb = mysql.connector.connect( host="localhost", user="root", passwd="root", database="school" ) print("Successfully Connected") #print(mydb) mycursor=mydb.cursor()   v1=int(input("enter ID:")) v2=input("enter name:") v3=input("enter Gender:") v4=int(input("enter age:")) sql='insert into TEACH values("%d","%s","%s","%s")'%(v1,v2,v3,v4) print(sql) mycursor.execute(sql) mydb.commit() print("record added") #MYSQL Connection code – Deletion on database SOURCE CODE: s=int(input("enter id of TEACHER to be deleted:")) r=(s,) v="delete from TEACH where id=%s" mycursor.execute(v,r) mydb.commit() print("record deleted") MYSQL Connection code – Updation on database SOURCE CODE: import mysql.connector mydb = mysql.connector.c...

QUESTIONS BASED ON PANDAS SERIES | IP

 QUESTIONS BASED ON PANDAS SERIES GRADE XII 1.Given the following Series1 A   100 B   200 C   300 D   400 E   500 Write the command to create above Series and then double the value in series and store in another series named Series2 Sol: import pandas as pd  Series1=pd.Series([100,200,300,400,500],index=['A','B','C','D','E'])  Series2=Series1*2  print(Series1)  print(Series2) 2. State whether True or False a. A series object is size mutable. b. A Dataframe object is value mutable Sol: a. A series object is size mutable. (False)  b. A Dataframe object is value mutable (True) 3. Consider a given Series , Series1: 200 700 201 700 202 700 203 700 204 700 Write a program in Python Pandas to create the series and display it. Sol: import pandas as pd  Series1=pd.Series(700,index=range(200,205))  print(Series1) 4.Consider the following Series object, s IP          95 Physics  ...