1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
elixir [45]
2 years ago
5

Write a lottery program that will ask the user if they would like to pick 5 numbers (1-30) or if they would like to choose EZ Pi

ck where the computer randomly picks their 5 numbers at a cost of $1.00. Then you will give them a chance to also play the Next Chance drawing for an extra $1.00. They do not choose additional numbers for the Next Chance drawing. Once they have all of their selections complete, have the computer game generate the five random winning numbers and if they opted for the Next Chance drawing, select 4 more random numbers. Display all of the users numbers, all of the winning numbers, and display how much, if any, that the player has won based on the following information:
Computers and Technology
1 answer:
Llana [10]2 years ago
6 0

Answer:

Explanation:

The following code is written in Python and creates arrays for the user's numbers and the next chance numbers, it also creates a cost variable and a did_you_win variable. The function takes in the winning numbers as an array parameter. It asks all the necessary questions to generate data for all the variables and then compares the user's numbers to the winning numbers in order to detect if the user has won. Finally, it prints all the necessary information.

import random

def lottery(winning_numbers):

   user_numbers = []

   next_chance_drawing = []

   cost = 0

   did_you_win = "No"

   #print("Would you like to choose your own 5 numbers? Y or N")

   answer = input("Would you like to choose your own 5 numbers? Y or N: ")

   if answer.capitalize() == "Y":

       for x in range(5):

           user_numbers.append(input("Enter number " + str(x+1) + ": "))

   else:

       for x in range(5):

           user_numbers.append(random.randint(0,31))

           cost += 1

   next_chance = input("Would you like to enter a Next Chance drawing for $1.00? Y or N: ")

   if next_chance.capitalize() == "Y":

       for x in range(4):

           next_chance_drawing.append(random.randint(0, 31))

           cost += 1

           

   if user_numbers == winning_numbers or next_chance_drawing == winning_numbers:

       did_you_win = "Yes"

   print("User Numbers: " + str(user_numbers))

   print("Next Chance Numbers: " + str(next_chance_drawing))

   print("Cost: $" + str(cost))

   print("Did you win: " + did_you_win)

You might be interested in
PLEASE HELP!!!!!! ASAP
NNADVOKAT [17]

Answer:

use a wizard or use a design view

Explanation:

i took the test

4 0
3 years ago
Read 2 more answers
During project management, who executes tasks and produces the deliverables as stated in the project plan and as directed by the
san4es73 [151]
B. Project team members
8 0
3 years ago
Vivek wants to save the data about his grocery store in a single table. Which among the following type of databases is used in t
Orlov [11]

Explanation:

A centralized database (sometimes abbreviated CDB) is a database that is located, stored, and maintained in a single location.

4 0
2 years ago
6. Choose the TWO conditions that could be used for an IF-statement, without a compile-time error. Assume variable str is a Stri
KengaRu [80]

Answer:

  1. 4 ==5
  2. "six"== 6

Explanation:

3 0
3 years ago
A company is executing a strategy to encrypt and sign all proprietary data in transit. The company recently deployed PKI service
Softa [21]

Answer:

A. S/MIME

B. TLS

C. Kerberos

Explanation:

PKI : Public Key Infrastructure is a technique which will allow services or applications to communicate securely across the unsecured network or internet.

PKI mainly consist of CA or Certificate Authority who can issue digital certificates or they are also known as trusted CA.  exmaples are godaddy, digicert, verizone, symmantec, etc.. and RA also known as Registration Authorities and they verify if the requested certificates can be stored at CA. Keys will be stored in the central directory.It will also consists of certificate management system and the policies governing PKI.

S/MIME : Secure/Multipurpose Internet Mail Extensions which use assymentric cryptography and sign the MIME data.   S/MIME will provide services like  Authentication, Encryption , Integrity, Privacy and Non repudiation for messaging applications

SMIME uses certificates which can be self signed or CA certified. It specifies MIME type as  application/pkcs7-mime  while transmitting the data.

TLS : Transport Layer Security. the earlier versions used to be known as SSL ( Secure Socket Layer) SSLv3 got depreciated and TLSv1.2/1.3 are popularly used to provide encryption, authentication, Integrity and Hashing for client to server side communication.

Most of the applications communicate securely using TLS.  They will establish secure TCP connection using SSL Handshake. During the Handshake they will exchange supported versions, ciphersuites and certificates. Applications which uses TLS always uses CA certificates and Inhouse applications can communicate using self signed certificate or even with CA certificates.

HTTPS which is also known as HTTP over SSL is widely used for almost all the web services to communicate securely across the internet.

Kerberos : It is a protocol used to prove the identity for two nodes which are communicating with each other. Kerberos uses both symmetric key cryptography and assymetric key cryptography. However, symmetric key cryptography is used widely and public key cryptography is used optionally.

Authentication server which is also known as AS is used to authenticate the requesting client.  It further forwards the user credentials to key distribution center. KDC further issues to TGT ( ticket granting ticket) and it uses TGS's secret key to encrypt. User will receive a encrypted output.  

When a User Login then The client authenticates itself to the Authentication Server (AS) which forwards the username to a key distribution center (KDC). The KDC issues a ticket-granting ticket (TGT), which is time stamped and encrypts it using the ticket-granting service's (TGS) secret key and returns the encrypted result to the user's workstation. Sessions will be renewed and managed by users session manager.

4 0
2 years ago
Other questions:
  • Having reviewed dod wireless stig (ver6, release 1), sarah learns she may only utilize secnet 54 and ______________ for transmit
    13·1 answer
  • Attacker player X is standing still on a corner kick, as the ball is played, he jumps up with his arms flailing above his should
    8·1 answer
  • Philip is thinking about customizing his motorcycle. A paint job, saddlebags, and a radio would cost $600. His motorcycle is old
    15·2 answers
  • ____ deals with ensuring that data is protected against unauthorized access, and if the data are accessed by an authorized user,
    10·1 answer
  • Most graphics software uses a process called pixel _________ to create new pixels by averaging the colors of nearby pixels.â
    6·1 answer
  • Can you plug a usb 2.0 into a 3.0 port on your computer
    12·1 answer
  • What is the main characteristic of a Peer-to-Peer (P2P) network?
    8·1 answer
  • Run a Monte Carlo simulation on this vector representing the countries of the 8 runners in this race: runners <- c("Jamaica",
    14·1 answer
  • Declare a typedef struct named jumper_t that will have four parts: character array name that is 16 in length, double array of tr
    12·1 answer
  • A small square at the right corner of the table is what?​
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!