Question
Write code in python programming. A school cafeteria is giving an electronic survey to its students to improve their lunch menu. Create a program that
Write code in python programming.
A school cafeteria is giving an electronic survey to its students to improve their lunch menu. Create a program that uses a list to store votes for the survey. The program should display four food items in the display. Then it prompts students to enter whether they like or dislike a particular food. Display a report thats updated as each new set of responses is entered. Use a 2-D Integer array named votes, with four rows and two columns to summarize the results. Each row corresponds to a food item. The columns store the number of like and dislike votes, respectively.
Question 5: Write a function that creates a two-dimensional matrix representing the Pascal triangle. In a Pascal triangle, each element is the sum of the element directly above it and the element to the left of the element directly above it (if any). A Pascal triangle of size 7 is shown below. 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 1 5 10 10 5 1 1 6 15 20 15 6 1 In the above example, element[0][0] is set to 1. Then element [0][1] os set to the sum of element[0][-1] + element[0][0]. Since there is no index is -1, your program must recognize that you are in column 0 and simply bring down the number above the current element. Element[1][1] then becomes the sum of element[0][0] + element[0][1]. Your function must be able to create the triangle of any size.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored 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