Introduction to Data Science Homework 4
Note: Please submit all of your codes and answers in one Jupyter Notebook file. Your codes must be executable, i.e., having no run-time errors. Questions 3, 4, and 5 are to write Python scripts. Please use a drawing tool (any) to draw your flowchart and insert its image into your submitted Jupyter Notebook file (hand-drawing is not allowed).
Question 1 (20 pts): Write pseudocode and draw a flowchart of an algorithm to compute 1 + 3 + 5
+ ... + (2n + 1), where n is an input.
Question 2 (20 pts): Consider the following Python code to print out a Fibonacci sequence. What is the problem size of the code? Explain your answer. Derive the Big-O of the code’s time complexity. Explain your derivation.
Question 3 (40 points):
a) Use a while loop to prompt the user to enter a number and if-else statements to print out that number or an error message if the input is not a number. Stop the loop after “quit” is entered.
b) Calculate 2n using a for loop (NOT using a Python built-in function to compute the power).
c) Calculate 1 + 2 + 22 + ... + 2n using a while loop.
d) Derive the time complexities of the programs for (b) and (c) in Big-O. Explain your derivation.
Question 4 (20 points):
a) Create an empty text file in the same folder as your .py script. Name it my_info.txt. Print out a prompt “Tell us about yourself” and then use a while loop to enter and write to the text file your information, such as your first and last names, department, program degree, hobby, ..., one by one in each iteration. Enter “quit” to exit the loop.
b) Open the text file obtained in a). Read and print out all the contents of the file.
Question 5 (bonus; 10 points): Read the first line of the text file created in Question 4, which contains your first and last names.
a) Return the position of the first letter of your last name.
b) Check the first letters of your first and last names. If either of them is in the lowercase, convert them into the uppercase. Then print out the names.
CS 340 Milestone One Guidelines and Rubric Overview: For this assignment, you will implement the fundamental operations of create, read, update,
Retail Transaction Programming Project Project Requirements: Develop a program to emulate a purchase transaction at a retail store. This
7COM1028 Secure Systems Programming Referral Coursework: Secure
Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip
CS 340 Final Project Guidelines and Rubric Overview The final project will encompass developing a web service using a software stack and impleme