Question: This task is about vectors and how we can work with such to simulate, for example, a lottery ticket. And that is also what this
This task is about vectors and how we can work with such to simulate, for example, a lottery ticket. And that is also what this task is about. We will choose a number of values and randomly select balls. Then we will see how many points we got You have previously come into contact with random numbers.
The following code is used to generate random numbers: For example, to create random numbers (between 1 and 20) in Python, you can write: import random random = random.randint(1,20)
The challenge in the task is that you must create a vector that holds ten values. The program must then iterate (repeat) for each position in the vector.
This is done with a for loop. For each "turn" in the loop, you should let the user enter a number. This number will then be placed in the next free position in the vector.
For this purpose you use a for loop. In the next step, you must iterate through the vector that is filled with numbers. If a number in the vector matches the entered number, you get "bingo".
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
