I’m working on a python question and need guidance to help me lea

Learning Goal: I’m working on a python question and need guidance to help me learn.
Solve the problem in the screen shot
card.py code
import random
faceValues = [‘ace’, ‘2’, ‘3’, ‘4’, ‘5’, ‘6’,
‘7’, ‘8’, ‘9’, ’10’, ‘jack’,
‘queen’, ‘king’]
suits = [‘clubs’, ‘diamonds’, ‘hearts’,
def shuffledDeck():
deck = []
for faceValue in faceValues:
for suit in suits:
deck.append(faceValue + ‘ of ‘ + suit)
return deck
def faceValueOf(card):
return card.split()[0]
def suitOf(card):
return card.split()[2]
My code
import cards
# input the initial amount for the game
initialAmount = float(input(“Enter initial amount: “))
# initialize total number of rounds for 1000 trials to 0
totalRounds = 0
# loop 1000 times
for n in range(1000):
# initialize the number of rounds needed for ith trial to 0
rounds = 0
# set amount to initialAmount
amount = initialAmount
# loop that continues until the round is over i.e the user runs out of money or doubles the initial amount
while amount > 0 and amount < 4.865*initialAmount:
rounds += 1 # increment number of rounds by 1
aceFound = False # set aceFound to false
# get a shuffled deck of cards
deck = cards.shuffledDeck()
# loop to deal 6 cards from the shuffled deck
for i in range(6):
faceValue = cards.faceValueOf(deck[0]) # get the first card of deck and get its face value
if faceValue == “ace”: # this is an ace, set aceFound to true and exit the inner for loop
aceFound = True
deck.pop(0) # remove the first card from deck
# if ace was found in one of the 6 cards dealt, increment amount by 1
if aceFound:
amount += 1
else: # else decrement amount by 1
amount -= 1
totalRounds += rounds # add number of rounds played to totalRounds
# determine and display the average number of rounds by dividing total rounds by 1000
print(“Average number of rounds: {:.3f}”.format(totalRounds/1000))
# end of test4.py

Place your order
(550 words)

Approximate price: $22

Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
The price is based on these factors:
Academic level
Number of pages
Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Read more

Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

Read more

Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Read more

Privacy policy

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

Read more

Fair-cooperation guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.

Read more