Assignment Question are in 3 word documents.
Homework #10 The Program The Pseudocode and Review instructions below. They are like programming exercises #1, 2, 3, 4 and 5 of the text book page 540 5th edition. A - Write pseudocode for what you create below using Chapter 1-10 methods. 15 points Python the Program: B - Write a python program using Chapter 1- 10 methods. 15 points Below is a combination of the books exercises #1, 2, 3, 4, and 5 of the textbook page 540 5th edition. You can read those but please be sure to follow the directions below: The Program Using Windows Notepad (or similar program), create a file called Numbers.txt in your the same folder as your Python program. This file should contain a list on floating point numbers, one on each line. The number should be greater than zero but less than one million. Your program should read the following and display: · The number of numbers in the file (i.e. count them) (counter) · The maximum number in the file (maximum) · The minimum number in the file (minimum) · The total of all the numbers in the file (total) · The average of all the numbers in the file (average) The count should be displayed as an integer (a whole number, no decimal point). The other numbers should be displayed truncated to the nearest thousandth (three digits to the right of the decimal point), with the decimal points aligned, and use the comma for the thousand separator. The count should be aligned with the other numbers even though it is an integer (see screenshot). The file may contain up to 1,000 numbers in it. Do not use any directory name in your file name, only Numbers.txt. add bigger numbers left and right of decimal point to the created numbers file. The file will contain only lines with numbers. There will not be a blank line at the end of the file. Do not use arrays for this assignment. It's actually easier to write without arrays (although it takes some more thought up front). Use the for loop to read the file like we did in Demo_10_02_ReadLoop.py . DO NOT read the files using readline() like we did in Demo_10_04_WriteReadWMenu.py . This will save you a significant amount of time. Screenshot Here's an example of what your input should look like: Here's an example of what your program should look like: Hint* use the padding to figure out the spacing here…. This whole project is 26 lines of code without comments and blank spaces. Keep it simple! · Make sure you follow the coding standards for this class, even if the author does not. Run through Pep8. What To Turn In For this assignment you need to turn in: · Your Pseudocode program file named Homework_10.docx or .pdf. · Your working Python program file named Homework_10.py. · Screenshot of completed shell or pasted in Word file as HomeworkShell_10.doc or saved completed shell as HomeworkShell_10.py. · Homework #9 The Program The Pseudocode and Complete programming exercise #2 and # 4 of the text book page 467 5th edition or page 375 4th edition. A - Write pseudocode using Chapter 1-9 methods. 15 points Do both the sort and the binary search Python the Program: B - Write a python program using Chapter 1- 9 methods. 15 points Complete programming exercise #2 and #4 on page 467 (5th edition) or page 375 (4th edition). Do both the sort and the binary search The user will enter exactly 20 names. Use a bubble sort to complete the sort in this exercise. Use a binary search to complete the search in this exercise. Display the position number of the name (zero-indexed) and the number of array lookups required for each search. Allow the user to do as many searches as they'd like. If the user enters a name that is not on the list you can either display nothing or you may print out an appropriate message to the user. The user will indicate they are done searching by pressing enter (and then the program will end). Screenshot Here's an example of what you program should look like. Notes · This assignment is can be considered super easy or super hard dependent on level of understanding. Please plan accordingly. · You can use the copy & paste method to enter test data. This makes testing easier. Make sure you know how to do this before you leave class. · In the pseudocode in the text and in the Python companion guide the author passes an array as a parameter to procedures modules. We saw how to do this in Demo_08_03_passing arrays.py . You do not need to do this. Instead you may use one big main() procedure. You do not have to use other procedures or functions. I know this is at odds with the best practices of modular programming (chapters 3 and 6), but in this case you will avoid the problems by reference variables and passing arrays as parameters. · Remember that you cannot use global variables in this class. Do not declare your array outside of main(). · The author gives you an example of a bubble sort (Program_09_01_Python.png) in the Python Companion Guide . You may reference this code as needed. · The author gives you an example of a binary search (Program_09_04-7_Python.png) in the Python Companion Guide . You may reference this code as needed. Make sure you program prints out the required information (described above), including the number of lookups. You may put your print statements directly in the binary search function, which effectively makes it a procedure, not a function. · Make sure you do a Binary Search, not a linear search (a.k.a sequential search). If you do linear search I will grade it just like you skipped the search all together. · If the user searches for a name that does not exist you must display”Name not found”and tell the user how many array lookups it took. See the screenshot for an example. · Make sure you follow the coding standards for this class, even if the author does not. · There is a bug in the author's code. I will not tell you what it is, and it is not on the errata page. It should not be too hard to find or fix. · Remember that when you swap the values of two variables (or two elements in an array) you need a temporary variable. See Demo_09_02_swapArrays.py . · Don't forget that you are not allowed to use break, continue, or System.exit() in this class. You also may not use return inside of main()(which is essentially the same as an exit). · Use must write these algorithms yourself. Do not use any built-in search or sorting code (e.g. Arrays.sort()). Hints/Reminders from PPT: · Must use Bubble Sort first before searching · # 2 and # 4 combination from book 467-468 · Have to do the bubble sort not the insertion sort!!! · Case sensitive lower to upper · Don’t need to make case sensitive assume 1st upper and rest are lowercase. · 9-2 Make that 20 names but can test with 3 or 4 names until get program working and use bubble_sort function from Demo09_01_bubbleSort.py module · 9-4 Use program 9-2. Make sure that works and then save as and rename as 9-4 and add code to ask user to enter a name to search for and then add def for binary_search from Demo_09_04_binarySearch.py program we just looked at in class and call with name you entered. Test your program with name in list and a name not in the list. If in list print
found and not found if not in list . is the variable searched for Only turn in one file of both together, just keep 09-02 separate jic. What To Turn In For this assignment you need to turn in: · Your Psuedocode program file named Homework_09.docx or .pdf. · Your working Python program file named Homework_09.py. · Screenshot of completed shell or pasted in Word file as HomeworkShell_08.doc or saved completed shell as HomeworkShell_08.py. Homework #8 The Psuedocode and Python the Program: Complete programming exercise 8-9 of the text book page 415: A - Write pseudocode using Chapter 1-8 methods. 15 points B - Write a python program using Chapter 1- 8 methods. 15 points Additional Requirements · The user's entries will be case insensitive. A lowercase a will be treated the same as a capital A. (Note: turn the users answer into the uppercase version of their answer). · When displaying the wrong answers, all answers should be displayed as capital letters (see screenshot). · You program should not crash if the user does not enter an answer (hits the enter key). Besides this your program does not need to be defensive. For example, if the user enters a Z or a multi-character answer you do not need to tell the user that they entered a nonsense answer. Treat this as a wrong answer. · The wrong answers must be displayed in a chart like the screenshot. Note that the values are displayed centered on there heading (as close as possible). All answers should be capitalized. · You will have 20 assignment statements to initialize the correct answer array. Normally we would not hard code the answers into the program like this, but at this point that's all we know how to do. You can use a single comment to cover all 20 lines. · Your program must use one or more loops for prompting the user for answers and check their answers. You may not copy, paste, and tweak twenty times for this. Notes · You will need two parallel arrays for this assignment. You may use a third array if you want. · Your arrays will all be one dimensional. · I suggest that you use three loops for your assignment: 1. The first loop should prompt the user for their twenty answers. It should also capitalize their answer. 2. The second loop should calculate the number or correct and incorrect answers. 3. The third loop should display the incorrect answers. You may combine the first and second loops together if you like. Screenshot Here's an example of what you program should look like: What To Turn In For this assignment you need to turn in: · Your Psuedocode program file named Homework_08.docx or .pdf. · Your working Python program file named Homework_08.py. · Screenshot of completed shell or pasted in Word file as HomeworkShell_08.doc or saved completed shell as HomeworkShell_08.py. Notes · This assignment is more difficult than the previous ones. Please plan accordingly. · You can use the copy & paste method to enter test data. This makes testing easier. Make sure I show this to you before you leave class. · Remember that you cannot use global variables in this class. Do not declare your array outside of main()). · Don't forget that you are not allowed to use break, continue, or System.exit() in this class. You may also not use return inside of main()(which is essentially the same as an exit). · I suggest