Skip to main content

Posts

GRADE XII - MYSQL CONNECTIVITY WITH PYTHON

  GRADE XII - MYSQL CONNECTIVITY WITH PYTHON SOURCE CODE : #ADD TO DATABASE import mysql.connector mydb = mysql.connector.connect( host="localhost", user="root", passwd="root", database="school" ) mycursor=mydb.cursor() v1=input("enter GROCERY ID:") v2=input("enter GROCERY NAME:") v3=int(input("enter PRICE:")) v4=int(input("enter QUANTITY:")) sql='insert into GRO values("%s","%s","%d","%d")'%(v1,v2,v3,v4)  #print(sql) mycursor.execute(sql) mydb.commit() print("*********Grocery Added To Database Successfully*****") #TO VIEW DATA sql="select * from gro" mycursor.execute(sql) res=mycursor.fetchall() print("The AVAILABLE GROCERY details are as follows : ") print("G_ID    NAME     PRICE   QUANTITY") print("\n##*************************************** ************ ##") for x in res:         print(x) print("\n##**...
Recent posts

GRADE XII IP - DATAFRAME OPERATIONS | 9-4-26

  PYTHON PANDAS BASIC DATAFRAME OPERATIONS import pandas as pd import numpy as np print("\nPYTHON PANDAS BASIC DATAFRAME OPERATIONS") # Creating DataFrame data = {     'Name': ['Amba', 'Radha', 'Sharada', 'Ayan'],     'Score': [90, 76, 88, 89] } df = pd.DataFrame(data) print("\nINITIAL DATAFRAME IS:\n") print(df) # Basic Operations print("\nMaximum Value in the Entire DataFrame is:", df.values.max()) print("\nMinimum Value in Score Column is:", df['Score'].min()) print("\nMaximum Value in Score Column is:", df['Score'].max()) print("\nMean of Score Column is:", df['Score'].mean()) print("\nNumber of Records in DataFrame:\n", df.count()) print("\nSum of Score Column:", df['Score'].sum()) # Sorting print("\nSorting DataFrame by Name:\n", df.sort_values('Name')) # Updating using loc print("\nUpdating Score of...

GRADE XII IP - Creating DataFrame from Dictionary

  Creating DataFrame from Dictionary 1. Dictionary of List import pandas as pd # Creating dictionary data = {     'Name': ['Aman', 'Riya', 'Karan', 'Sita'],     'Class': ['XII', 'XII', 'XII', 'XII'],     'Marks': [85, 90, 78, 88] } # Creating DataFrame df = pd.DataFrame(data) # Display DataFrame print(df) 2. import pandas as pd data = {     'Product': ['Pen', 'Pencil', 'Eraser'],     'Price': [10, 5, 3] } df = pd.DataFrame(data, index=['P1', 'P2', 'P3']) print(df) Creating DataFrame from List of Dictionaries import pandas as pd # List of dictionaries data = [     {'Name': 'Aman', 'Marks': 85, 'Subject': 'Math'},     {'Name': 'Riya', 'Marks': 90, 'Subject': 'Science'},     {'Name': 'Karan', 'Marks': 78, 'Subject': 'English...

GRADE XII - MYSQL JOIN QUERY ASSIGNMENT

  MYSQL JOINS Given Tables Student(RollNo, Name, Class) Marks(RollNo, Subject, Marks) Questions 1. Write a query using Equi Join to display Student Name and Marks. 2. Write a query using Equi Join to display all columns from both tables where RollNo matches. 3. Write a query using NATURAL JOIN to display all matching records. 4. Write a query using NATURAL JOIN to display Name, Subject, and Marks. 5. Write a query to display all possible combinations of Student and Marks using Cartesian Product. 6. Write a query using Cartesian Product with WHERE condition to display only matching RollNo records. 7. Identify the type of JOIN used in: SELECT * FROM Student, Marks; 8. Predict the number of rows returned by: SELECT * FROM Student, Marks; 9. Write a query using Equi Join to display names of students who have marks greater than 85. 10. Write a query using NATURAL JOIN to display records of Class 12 students only. 11. Write a query using Equi Join to display RollNo, Name, and Subject. 12...

GRADE XI | DESIGN THINKING & INNOVATION (848) | INTRODUCTION NOTES

  DESIGN THINKING &  INNOVATION (848)  INTRODUCTION LINK : INTRODUCTION PPT PPT LINK Notes: Design Thinking and Innovation Grade XI Introduction Section   I. What is Design? (0.1.1) Definitions from Experts: John Maeda: "Design is solution to a problem". Saul Bass: "Design is thinking made visual". Charles Eames:   “Design is a plan for arranging elements in such a way as best to accomplish a particular purpose.” Steve Jobs:  "Design is not just what it looks like and feels like. Design is how it works". Prof. Sudhakar Nadkarni:  "Essentials of design are— purity, precision, details". Design is a way of understanding needs, identifying problems, and creating appropriate and innovative solutions. It is not only about appearance, but also about usefulness and sustainability. Design is explained as something that helps solve problems and make a positive difference. Key ...

PANDAS SERIES - 16 /3/26

  PRACTICE QUESTIONS Pandas Series – Practice Questions 1. Write a program to create a Pandas Series containing English alphabets from ‘a’ to ‘z’ and display it. 2. Write a statement to display the alphabets ‘e’ to ‘p’ from the Series EngAlph. 3. Write a statement to display the first 10 values from the Series EngAlph. 4. Write a program to create a Series named 'vow' containing vowels (‘a’, ‘e’, ‘i’, ‘o’, ‘u’) with initial value 0 and display it. 5. Write a statement to set all the values of the Series 'vow' to 10 and display the updated Series. 6. Write a statement to divide all values of the Series 'vow' by 2. 7. Create another Series 'vow1' having 5 elements with index labels ‘a’, ‘e’, ‘i’, ‘o’, ‘u’ and values [2,5,6,3,8] respectively. 8. Write a program to add two Series 'vow' and 'vow1' and store the result in a new Series 'vow3'. 9. Write statements to perform subtraction, multiplication and division betwe...