Lab 4 ipynb - Colab
Lab 4 ipynb - Colab
('AL', 'Quida')
def sum_of_tuples(tuples_list):
return [sum(tup) for tup in tuples_list]
[10, 9, 13]
def get_initials(names):
return tuple(f"{name[0]}{name.split()[1][0]}" for name in names)
CODE 4
def max_in_tuple(numbers):
if not numbers:
return None
return max(numbers)
empty_tuple = ()
max_value_empty = max_in_tuple(empty_tuple)
print(max_value_empty)
44
None
def count_vowels_in_names(names):
vowels = "aeiouAEIOU"
count = 0
enrollment_status = {
"Saif": True,
"Sial": False,
"Amin": False,
"Arqam": False
}
student_name_to_check = "Saif"
status = check_enrollment(enrollment_status, student_name_to_check)
print(f"{student_name_to_check}: {status}")
student_name_not_found = "Amin"
status_not_found = check_enrollment(enrollment_status, student_name_not_found)
print(f"{student_name_not_found}: {status_not_found}")
Saif: True
Amin: False
def user_portal():
users = {}
while True:
response = input("Are you a registered user? (yes/no): ").lower()
if response == 'no':
# Sign up process
username = input("Enter your username: ")
password = input("Enter your password: ")
users[username] = password
print("Registered successfully.")
else:
print("Please answer 'yes' or 'no'.")
user_portal()