Use spyder Please take a screenshot and make sure the codes are working. Thank you
Posted: Sun Jul 03, 2022 11:22 am
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')
Question 3 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 14 6 4 1 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. 2 1 3 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.
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')
Question 3 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 14 6 4 1 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. 2 1 3 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.