Python Programming: An Introduction to Computer Science
Python Programming: An Introduction to Computer Science
3rd Edition
ISBN: 9781590282779
Author: John Zelle
Publisher: Franklin Beedle & Associates
bartleby

Concept explainers

bartleby

Videos

Question
Book Icon
Chapter 11, Problem 15PE
Program Plan Intro

Program to deal out a sequence of cards

Program plan:

  • Import the required packages
  • A class named “Deck” is defined.
  • The function named “__init__()” is defined and inside it,
    • Declare and initialize the required array variables.
    • A loop is initialized to derive the values of cards.
      • Calculate the store the values in “x” and “y”.
      • Then the cards are appended in the array named “cardSpecs[]”.
    • Declare another array named “cards[]”.
    • A loop is initialized to append the cards in the array named “cards[]”.
  • The function named “__shuffle()” is defined and inside it,
    • Declare and initialize the required array variables.
    • A loop is initialized to store the shuffled cards.
      • Calculate the store the values in “x”.
      • Then the cards are appended in a new array named “newList[]”.
      • Remove that value of x from previous array named “cards[]”.
      • Return the value stored in newList.
  • The function named “shuffle()” is defined and inside it,
    • Assign the value stored in “self.__shuffle()” to “self.cards”.
  • The function named “dealCards()” is defined and inside it,
    • Return the value stored in first “self.cards.pop()”.
  • The function named “cardsLeft()” is defined and inside it,
    • Return the length of the value stored in “self.cards()”.
  • In the “main()” function,
    • Declare the variable “deck” that creates the class named “Deck()”
    • The function named “shuffle()” is called.
    • A loop is initialized to store the shuffled cards.
      • Print the output value that returned from “deck.dealCard()”.
  • Call the function “main()”.

Blurred answer
Students have asked these similar questions
I want to ask someone who has experiences in writing physics based simulation software. For context I am building a game engine, and want to implement physics simulation. There are a few approaches that I managed to find, but would like to know what are other approaches to doing physics simulation entry points from scenes, would you be able to visually draw me a few approaches (like 3 approaces)?When I say entry point to the actual physics simulation. An example of this is when the user presses the play button in the editor, it starts and initiates the physics system. Applying all of the global physics settings parameters that gets applied to that scene.Here is the use-case, I am looking for. If you have two scenes, and select scene 1. You press the play button. The physics simulation starts. When that physics simulation starts, you are also having to update the physics through some physics dedicated delta time because physics needs to happen faster update frequency.To elaborate, what…
Male comedians were typically the main/dominant star of television sitcoms made during the FCC licensing freeze.   Question 19 options:   True   False In the episode of The Honeymooners that you watched this week, why did Alice decide to get a job outside of the home?   Question 1 options:   to earn enough money to buy a mink coat   to have something to do while the kids were at school   to pay the bills after her husband got laid off
After the FCC licensing freeze was lifted, sitcoms featuring urban settings and working class characters became far less common.   Question 14 options:   True   False
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
9.1: What is an Array? - Processing Tutorial; Author: The Coding Train;https://www.youtube.com/watch?v=NptnmWvkbTw;License: Standard Youtube License