Professional Documents
Culture Documents
Set 5
Set 5
1. Write a Python script that inserts two records, each containing Roll_no, Name,
and
Marks, into a CSV file.
import pickle
file = open ("C:\\Users\\saran\\OneDrive\\Desktop\\exam cs\\4.txt", "wb+")
dic = { }
n = int (input ("Enter number of students : ") )
for key in range (n) :
roll_no = int (input ("Enter roll no") )
name = input ("Enter name : ")
marks = int (input ("Enter your marks : ") )
dic [roll_no] = { }
dic [roll_no] ["name"] = name
dic [roll_no] ["marks"] = marks
print(dic)
pickle. dump (dic, file)
file. close ( )
use student;
i. Write a SQL query to add column “class” and the Datatype is Varchar.
Alter table student add class varchar(30);
ii. Write SQL Query to display all the record in the table.
select * from student;