-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAssignment21(Tuple).py
More file actions
38 lines (30 loc) · 1.08 KB
/
Assignment21(Tuple).py
File metadata and controls
38 lines (30 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#Write a python program and iterate the given tuples Input: employee1 = ("John Doe", 101, "Human Resources", 60000) employee2 = ("Alice Smith", 102, "Marketing", 55000) employee3 = ("Bob Johnson", 103, "Engineering", 75000)
# Define tuples for employee records
employee1 = ("John Doe", 101, "Human Resources", 60000)
employee2 = ("Alice Smith", 102, "Marketing", 55000)
employee3 = ("Bob Johnson", 103, "Engineering", 75000)
# Create a list to store multiple employee records
employee_records = [employee1, employee2, employee3]
# Print employee records
print("Employee Records:")
for employee in employee_records:
name, emp_id, department, salary = employee
print(f"Name: {name}")
print(f"Employee ID: {emp_id}")
print(f"Department: {department}")
print(f"Salary: ${salary}\n")
""" OUTPUT=>
Employee Records:
Name: John Doe
Employee ID: 101
Department: Human Resources
Salary: $60000
Name: Alice Smith
Employee ID: 102
Department: Marketing
Salary: $55000
Name: Bob Johnson
Employee ID: 103
Department: Engineering
Salary: $75000
"""