Page 1 of 1

Use spyder Please take a screenshot and make sure the codes are working. Thank you

Posted: Sun Jul 03, 2022 9:59 am
by answerhappygod
Use spyder
Please take a screenshot and make sure the codes are working. Thank you
Each program must start with a multi-line comment as shown below. For Assignment 2 question 2,you should replace x with 2 and y with 2. Replace each occurrence of DentStew and StewDent with your name. Replace yyyy/mm/dd with the date you completed the program. # DentStewAxQy.py # # Course: # Instructor: # Assignment: # Author: # Version: # COMP 1012 Abolfazl x Question y Stew Dent yyyy/mm/dd # Purpose: The purpose of the program. # # var1 - the use / meaning of each variable in the program Begin each program with the following statements. from time import ctime print('\n----- End each program with the following statements. Print(""" Programmed by Stew Dent Date: %s End of processing.""" % ctime()) Replace Stew Dent with your real name. The name of each program should be of the form: LastnameFirstnameAnQm If your name is Stew Dent and the program is for assignment 1 question 1 then the name of the program should be: DentStewA2Q1 The corresponding python file would be named: DentStewA2Q1.py -\n')
The purpose of this question is to write a program that grabs a list, recognizes and removes the duplicated items. To answer this question, write a function that first ask the user to enter the length of a list. Then, grabs the elements of the list one by one. def grabList(): Afterwards, then write another function that search inside that list element by element and find the duplicated items. def listSearch(): In this function if an element is occurred more than one time, it should be recognized by the program and increase its frequency of occurrence. Basically, in the listSearch() function, a list should be built that each element of that is the frequency of the corresponding element in the output of the grabList() function. In order to remove the duplicated items, write another function: def delDup(): This function will search in the frequency of occurrence of each element and delete the ones that their frequency of occurrence is more than one, meaning removing the item which occurs more than once. For example: list=[1,1,2,3,4,5]→ final list should be equal to [2,3,4,5] All these functions can be called either in a main () function or in a main code body. Note: The code should be able to mention which element(s) was duplicated and remove from the final list. Test your program using different lists with different lengths and elements Enter the length of the list: 4 Enter element 1: 12 Enter element 2:2.4 Enter element 3: a Enter element 4: 2.4 The final list is: [12,a] The element 12 occurs 1 time at 0. The element 2.4 occurs 2 times at 1,3 => it is removed The element a occurs 1 time at 2. Programmed by Stew Dent. Date: Fri Jun 17 08:43:31 2022 End of processing.
Write a function that can return the row of Pascal's triangle. Pascal's triangle is an arithmetic and geometric figure first imagined by Blaise Pascal. Your function can be: def PasTri(n): where "n" is the number of row that we want to have in the output. Figure below shows the structure of a Pascal's triangle. 1 1 PasTri (6) [1] [1, 1] [1, 2, 1] [1, 3, 3, 1] [1, 4, 6, 4, 1] [1, 5, 10, 10, 5, 1] 1 2 1 3 3 1 46 41 As you can see in the image, each number is the two numbers above it added together except the numbers in on the edge of the triangle where all of them are one. Note: To answer this question, you have to use zip function. Your function will get the n from input and print the numbers till the row number "n" as it is shown below: Test your program using different lists with different lengths and elements Programmed by Stew Dent. Date: Fri Jun 17 11:24:14 2022 End of processing.