PYTHON_practical
PYTHON_practical
Bachelor of Technology
In
Artificial Intelligence and Machine Learning
Submitted By
Session 2024-25
DECLARATION BY THE CANDIDATE
We hereby declare that the work entitled “Schema for College Database” is our work,
conducted under the supervision of Mr. Ashish Singh (Assistant Professor) & Mr.
Khemchand Shakywar (Assistant Professor), during the session Aug-Dec 2024. The report
submitted by us is a record of bonafide work carried out by me.
We further declare that the work reported in this report has not been submitted and will not be
submitted, either in part or in full, for the award of any other degree or diploma in this institute
or any other institute or university.
--------------------------------
Date: 21.11.2024
Place: Gwalior
This is to certify that the above statement made by the candidates is correct to the best of our
knowledge and belief.
ACKNOWLEDGEMENT
We would like to express our greatest appreciation to all the individuals who have helped and
supported us throughout this report. We are thankful to the whole Centre for Artificial
Intelligence for their ongoing support during the experiments, from initial advice and provision
of contact in the first stages through ongoing advice and encouragement, which led to the final
report.
A special acknowledgement goes to our colleagues who help us in completing the file and by
exchanging interesting ideas to deal with problems and sharing the experience.
We wish to thank the faculty and supporting staff for their undivided support and interest which
inspired us and encouraged us to go my own way without whom we would be unable to
complete my project.
In the end, We want to thank our friends who displayed appreciation for our work and
motivated us to continue our work.
if re.match(pattern, email):
print("Valid email ID")
else:
print("Invalid email ID")
OUTPUT:
Macro Project:
Suppose a text file contains information about students in the form of Name,
10th-class exam roll number, marks in physics, marks in chemistry and
marks in mathematics. Write a python script to generate a text file
containing subject-wise merit list
INPUT:
Text File: students.txt
Aadi,0901004,85,78,92
Arman,0901005,91,88,84
PM,0901006,76,82,89
Aditya,0901007,93,79,85
Python Script:
def read_student_data(filename):
students = []
with open(filename, 'r') as file:
for line in file:
if line.strip(): # Skip empty lines
name, roll_number, physics, chemistry, math = line.strip().split(',')
students.append({
'name': name,
'roll_number': roll_number,
'physics': int(physics),
'chemistry': int(chemistry),
'math': int(math)
})
return students
def write_merit_list(students, subject, filename):
sorted_students = sorted(students, key=lambda x: x[subject], reverse=True)
OUTPUT:
Mini Project
Create a login module with below mentioned features:
a. Verify username and password correctly
b. Register new user and set its password
c. Change password of any registered user
Note: Store the usernames and passwords in a Dictionary
INPUT:
# Dictionary to store usernames and passwords
users_db = {}
if choice == '1':
username = input("Enter new username: ")
password = input("Enter password: ")
register_user(username, password)
else:
print("Invalid option, please try again.")
if __name__ == "__main__":
main()
OUTPUT