Cs 1101 Unit 6 Checklist

Words: 513
Pages: 3

Written Assignment Unit 6: Lists University of the People CS 1101: Programming Fundamentals Dr. Clifford Kettemborough, Instructor March 9th 2024.

Part a

As a Data Analyst in an organization, the HR department has tasked me with performing a series of operations on a list of 10 employees. The names on the list are Grace, Philip, Damaris, Caroline, Edgar, Jayden, Stacy, Cynthia, Millicent, and Nicholas.

Python code for performing the operations.

Python Initial list of employee names employee_list = ['Grace', 'Philip', 'Damaris’, ‘Caroline', 'Edgar', 'Jayden', 'Stacy', 'Cynthia', 'Millicent', 'Nicholas'] ['Grace', 'Philip', 'Damaris',

Splitting the list into two sub-lists subList1 = employee_list[:5] subList2 = employee_list[:5]

Adding
…show more content…
Sorting the salaryList and displaying the top 3 salaries salaryList.sort(reverse=True) top_3_salaries = salaryList[:3].

print("Merged List of Employees:", merged_list) print("Updated Salary List with 4% Raise:", salaryList) print("Top 3 Salaries:",
…show more content…
The Python code efficiently split, merged, updated, and sorted the data as required. This demonstrates the importance of data manipulation and analysis in HR operations within an organization.

Part b

In this program, we will create a Python program that takes a sentence as input and converts it into a wordlist. Then, we will reverse the wordlist and display the output. This program will involve string manipulation and list operations in Python.

Code: Python def reverse_wordlist(sentence): # Split the input sentence into a wordlist wordlist = sentence.split() Reverse the order of the wordlist wordlist.reverse() return wordlist.

Input sentence input_sentence = "I like programming"

Call the function and store the reversed wordlist reversed_wordlist = reverse_wordlist(input_sentence).

Print the reversed wordlist