Question
Creating dictionaries, storing data, and manipulating them. Familiarize yourself with Set operations. Working with files to read, write, and update data. Exercise 1: Write a
Creating dictionaries, storing data, and manipulating them. Familiarize yourself with Set operations. Working with files to read, write, and update data. Exercise 1: Write a python program to create a dictionary that stores the sequence from 1 to N (which is a user input) as keys, and the values are Fibonacci numbers which is resulting of the sum of previous two values. Examples: Expected output (N = 5): dict = {1:0, 2:1, 3:1, 4:2, 5:3} Expected output (N = 10): dict = {1:0, 2:1, 3:1, 4:2, 5:3......, 10:34) Expected output (N = 20): dict = {1:0, 2:1, 3:1, 4:2, 5:3....... 20:4181} Exercise 2: Write a Python program to count the number of characters (character frequency) in a string. Sample String: google.com Expected Result : {'g': 2, 'o': 3, IT: 1, 'e': 1,': 1, 'c': 1, 'm': 1} Exercise 3: Write a Python program to find the elements in a given set that
SetB = [1,2,3,4,5) Expected output (1,2,3) Expected output: (8.6.7) Exercise 4: Write a Python program to extract a list of values from a given list of dictionaries. Original Dictionary: [{Math': 90, "Science": 92), ("Math: 89, Science: 94). {Math': 92. "Science": 88}] Extract a list of values from said list of dictionaries where subject = Science Expected Result: [92, 94,88] Extract a list of values from said list of dictionaries where subject = Math Expected Result: 190, 89, 92] Exercise 5: A): Write a python program that does the following: 1) ask the user how many employees records he/she would like to save 2) then loop the number user has entered a) open a f
records he/she would like to save 2) then loop the number user has entered a) open a file with the filename "Employee Records.txt". b) get the information about each record: each record should have three fields (Name, Department, Salary) C) each field should be in a separate line d) close the file Example of the output file (Employee Records.txt) Abdullah HR 7000 Ahmed IT 9000 B): Write a python program that does the following: 1) open the file you have created previously on section A ("Employee Records.txt") 2) delete the second record 3) if there is no such second record, display to the user "Couldn't find the second record" 4) close the file
Creating dictionaries, storing data, and manipulating them. Familiarize yourself with Set operations. Working with files to read, write, and update data. Exercise 1: Write a python program to create a dictionary that stores the sequence from 1 to N (which is a user input) as keys, and the values are Fibonacci numbers which is resulting of the sum of previous two values. Examples: Expected output (N = 5): dict = {1:0, 2:1, 3:1, 4:2, 5:3} Expected output (N = 10): dict = {1:0, 2:1, 3:1, 4:2, 5:3......, 10:34) Expected output (N = 20): dict = {1:0, 2:1, 3:1, 4:2, 5:3....... 20:4181} Exercise 2: Write a Python program to count the number of characters (character frequency) in a string. Sample String: google.com Expected Result : {'g': 2, 'o': 3, IT: 1, 'e': 1,': 1, 'c': 1, 'm': 1} Exercise 3: Write a Python program to find the elements in a given set that
SetB = [1,2,3,4,5) Expected output (1,2,3) Expected output: (8.6.7) Exercise 4: Write a Python program to extract a list of values from a given list of dictionaries. Original Dictionary: [{Math': 90, "Science": 92), ("Math: 89, Science: 94). {Math': 92. "Science": 88}] Extract a list of values from said list of dictionaries where subject = Science Expected Result: [92, 94,88] Extract a list of values from said list of dictionaries where subject = Math Expected Result: 190, 89, 92] Exercise 5: A): Write a python program that does the following: 1) ask the user how many employees records he/she would like to save 2) then loop the number user has entered a) open a f
records he/she would like to save 2) then loop the number user has entered a) open a file with the filename "Employee Records.txt". b) get the information about each record: each record should have three fields (Name, Department, Salary) C) each field should be in a separate line d) close the file Example of the output file (Employee Records.txt) Abdullah HR 7000 Ahmed IT 9000 B): Write a python program that does the following: 1) open the file you have created previously on section A ("Employee Records.txt") 2) delete the second record 3) if there is no such second record, display to the user "Couldn't find the second record" 4) close the file
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started