-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAssignment.py
More file actions
44 lines (32 loc) · 961 Bytes
/
Assignment.py
File metadata and controls
44 lines (32 loc) · 961 Bytes
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
39
40
41
42
43
44
# Tutedude assignment-5
#
#Data structure and string in python
#Task 1
#create a dictionary of student marks.
def stn_marks():
stn_data = {
"A": 85,
"B": 72,
"C": 90,
"D": 80,
"E": 80
}
stn_name = input("Enter the student name:")
if stn_name in stn_data:
marks = stn_data[stn_name]
print(f" {stn_name}'s marks is: {marks}")
else:
print(f"Entered Student's name :'{stn_name}'\nis not found in the data; .")
#call the function to run the program
stn_marks()
#Task -2
#
#create a list of numbers from 1to 10.
main_list = list(range(1, 11))
#2 Extracts the first five elements from the list.
extracted_list = main_list[0:5] # simply original_list[:5]
#3 Reverse these extracted elements
reverse_list = extracted_list[::-1]
print(f"Original List:{main_list}")
print(f"Extracted first five elements:{extracted_list}")
print(f"Reversed extracted elements:{reverse_list}")