0% found this document useful (0 votes)
2 views1 page

Class10 Python MySQL Practical PrintReady

The document contains multiple Python scripts for basic programming tasks including a simple calculator, random number generation, a guessing game, Fibonacci sequence generation, and calculating the average of five numbers. Additionally, it includes MySQL commands for managing databases and tables, such as creating a database, creating a table for employee records, and renaming the table. Each section demonstrates fundamental programming concepts and database operations.

Uploaded by

aditya2011tx
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views1 page

Class10 Python MySQL Practical PrintReady

The document contains multiple Python scripts for basic programming tasks including a simple calculator, random number generation, a guessing game, Fibonacci sequence generation, and calculating the average of five numbers. Additionally, it includes MySQL commands for managing databases and tables, such as creating a database, creating a table for employee records, and renaming the table. Each section demonstrates fundamental programming concepts and database operations.

Uploaded by

aditya2011tx
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Python 1 - Simple Calculator

num1=float(input('Enter first number: '))


num2=float(input('Enter second number: '))
print('Addition =',num1+num2)
print('Subtraction =',num1-num2)
print('Multiplication =',num1*num2)
if num2!=0:
print('Division =',num1/num2)
else:
print('Division not possible')

Python 2 - Random Number


import random
print([Link](1,100))

Python 3 - Guessing Game


import random
secret=[Link](1,10)
guess=int(input('Guess: '))
if guess==secret:
print('Correct!')
else:
print('Wrong! Secret=',secret)

Python 4 - Fibonacci
n=int(input('Terms: '))
a,b=0,1
for i in range(n):
print(a,end=' ')
a,b=b,a+b

Python 5 - Average
name=input('Name: ')
m1=float(input())
m2=float(input())
m3=float(input())
m4=float(input())
m5=float(input())
print('Average=',(m1+m2+m3+m4+m5)/5)

MySQL
SHOW DATABASES;
CREATE DATABASE management;
USE management;
CREATE TABLE Employee(Employee_ID INT PRIMARY KEY, First_Name
VARCHAR(30), Last_Name VARCHAR(30), Age INT, Department VARCHAR(30), City
VARCHAR(30));
-- Insert the 10 records from the worksheet
SELECT * FROM Employee;
SELECT COUNT(*) FROM Employee;
RENAME TABLE Employee TO Staff;

You might also like