Computer Lab Activity
1.WAP that validates whether a given string is a valid email id pattern or not.
email = input("Type your email address: ")
etuple = tuple(email)
if '@' in etuple and '.com' in etuple;
print("Valid email") else: print("Invalid email")
2.WAP that checks the strength of a password as strong or not based on length
, upper ,lower and special characters.
password = input("Enter your password: ")
plist = list(password)
if len(plist) >= 8:
if any(char.isupper() for char in plist):
special_characters = "!@#$%^&*"
if any(char in special_characters for char in plist):
print("Strong")
break
else:
print("Has to have at least one special character")
else:
print('Password has to be in uppercase')
else:
print('Password is too short')
3.WAP using tupels that can be used to store students records ,which includes
their name , ID and grades of 5 subjects.Program calculates the average grade
of each student. (the 3rd element in the tuple is list)
no_of_students = int(input("Enter the number of students: "))
students = []
for i in range(no_of_students):
name = input("\nEnter student's name: ")
student_id = input("Enter student's ID: ")
grades_input = input("Enter the grades as a list: ")
grades = eval(grades_input)
students.append((name, student_id, grades))
for student in students:
name, student_id, grades = student
average_grade = sum(grades) // len(grades)
print("Student:", name, "\nID:", student_id, "\nAverage Grade:", average_grade)