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

Videos

Question
Book Icon
Chapter 9, Problem 7PE
Program Plan Intro

Simulates craps game

Program Plan:

  • Import the header file.
  • Define the “main” method.
    • Call the “printIntro ()” method
    • Get the input from the user.
    • Call the “simNCraps ()” method and store it in a variable.
    • Call the “printSummary ()” method.
  • Define the “printIntro()” method.
    • Print the intro statements.
  • Define the “simNCraps()” method.
    • Set the values
    • Iterate “i” until it reaches “n” value
      • Check the condition
        • Increment the “winsA” value
      • Otherwise, increment the “losses” value.
      • Return the value.
  • Define the “simOneCraps ()” method
    • Call the “randrange ()” method
    • Check the “x” is equal to 2 or 3 or 12
      • Return false
          • Check the “x” is equal to 7 or 11
            • Return true
          • Otherwise,
            • Set the value
            • If “x” is not equal to “y” and 7
              • Call the “randrange ()” method
              • Check “y” is equal to 7
                • Return false
              • Check “y” is equal to “x”
                • Return true
  • Define the “printSummary ()” method
    • Display the results.
  • Call the main method.

Blurred answer
Students have asked these similar questions
Let the user choose encryption or decryption. For encryption, let user input the key in Hexadecimal number, the plain text in Hexadecimal number, output the ciphertext (in hexadecimal numbers). For decryption, let user input the key in Hexadecimal number, the ciphertext (in hexadecimal numbers), output the decrypted message (Hexadecimal number). Both encryption and decryption should output the different operation results for each round like the following: For example: Round 1: E(R0) = ...... (Hex or Binary) K1 = …… E(Ro) xor K1 = S-box outputs = …… f(Ro1, K1) = ….. L2 =R1 =……. La = Ra Round 2: .....• No Encryption/Decryption libraries or functions provided by the third party are allowed. Submit your program codes to Moodle with the notes of how to compile and run your program.
When the given integer variable numberOfPackages is: greater than 12, output "Needs more than one box". between 5 inclusive and 12 inclusive, output "Large box". between 0 exclusive and 4 inclusive, output "Small box". less than or equal to 0, output "Invalid input". End with a newline.
summarize in a short paragraph how to Advance Incident Response and Automation in ML home based security systems
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
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
Operations Research : Applications and Algorithms
Computer Science
ISBN:9780534380588
Author:Wayne L. Winston
Publisher:Brooks Cole
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Program to find HCF & LCM of two numbers in C | #6 Coding Bytes; Author: FACE Prep;https://www.youtube.com/watch?v=mZA3cdalYN4;License: Standard YouTube License, CC-BY