Question: Write a program that simulates a lottery. The program should have an list of five integers named lottery and should generate a random number in

Write a program that simulates a lottery. The program should have an list of five integers named lottery and should generate a random number in the range of 0 through 9 for each element in the list. The user should enter five digits, which should be stored in an integer list named user. The program is to compare the corresponding elements in the lists and keep a count of the digits that match.

For example:

Lottery list:

7

4

9

1

3

User List:

4

2

9

7

3

The program should display the random numbers generated in lottery list and the number of matching digits=2).

2. By using two-dimensional array, write Python program to display a table that represents a Pascal triangle of any size. In Pascal triangle, the first and the second rows are set to 5. Each element of the triangle (from the third row downward) is the sum of the element directly above it and the element to the left of the element directly above it.

See the example Pascal triangle(size=6) below:

5

5 5

5 10 5

5 15 15 5

5 20 30 20 5

5 25 50 50 25 5

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!