Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A student wrote a program but it has bad variable naming conventions AND they forgot to add comments to describe most of it ! Can

A student wrote a program but it has bad variable naming conventions AND they forgot to add comments to describe most of it!
Can you determine what real-world problem this program (below) is trying its BEST to simulate?
import random
array =[]
s=[]
array[0]=(input())
input())
input())
array[3]=(input())
input())
s[0]= random, randint (0,9)
s[1]= random. randint (0,9)
s[2]= random. randint (0,9)
s[3]= random. randint (0,9)
s[4]= random. randint (0,9)
count =0
for n in range (0,5) :
if (array[n]==s[n]):
count+=1
if (count 5):
print("Winner")
exit() #This will stop and exit the program
print("Loser")
It simulates the distribution of winnings in an auction.
It simulates ferrying animals across a river.
It simulates a lottery.
It simulates a game of poker.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Programming With Visual Basic .NET

Authors: Carsten Thomsen

2nd Edition

1590590325, 978-1590590324

More Books

Students also viewed these Databases questions