CS 1101 Unit 6
CS 1101 Unit 6
# Removing the second employee's name from subList1 using the del
del subList1[1] # Assuming the second employee is at index 1
# Salary list
salaryList = [50000, 55000, 60000, 65000, 70000, 75000, 80000, 85000, 90000,
95000]
top_3_salaries = salaryList[:3]
Code Output
Explanation:
# Sentence
input_sentence = "I really do love my food in the freezer"
Output:
Explanation:
The defined wordlist_reverse( ) function takes a sentence as input, splits it into a word
list using split() , and reverses the list using reversed() and list() functions.
The sample sentence is converted into a word list, and its reversed form is displayed as
seen in the screenshot above.