Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Write a program that will simulate the NJ Cash 5 lottery.
- The program must pick 5 numbers from 1 to 38 - No duplicates allowed
- The numbers will be selected one at a time.
- It must print these numbers side by side (do not print the list as a list) on one line under the heading "These are the cash 5 numbers."
- You will need to "import random" at the beginning of your code.
- Each randomly selected number shall be stored in a list.
- No number should repeat in the list.
- After selecting the 5 numbers, ask the user if they want to play again and allow them to do so.
- This will require nested loops and lists (arrays).
Deliverables:
- Python code
- Flowchart (.pdf)
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 5 steps with 3 images
Knowledge Booster
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
- JAVA: Write an application that accepts up to 20 Strings, or fewer if the user enters the terminating value ZZZ. Store each String in one of two lists: one list for short Strings that are 10 characters or fewer, and another list for long Strings that are 11 characters or more. After data entry is complete, prompt the user to enter which type of String list to display, either S for short or L for long and then output the correct list. For this exercise, you can assume that if the user does not request the list of short strings, the user wants the list of long strings. If a requested list has no Strings, output The list is empty. Prompt the user continuously until a sentinel value, ZZZ, is entered to quit the program. An example of the program is shown below: Enter a string or ZZZ to quit >> Green Enter a string or ZZZ to quit >> Green eggs Enter a string or ZZZ to quit >> Green eggs and ham Enter a string or ZZZ to quit >> I do not like green eggs and ham Enter…arrow_forwardThe python function first_words takes one parameter, fname, the name of a text file, and returns a list containing the first word from each line of the file. For example, if the file contents are: apples are red bananas are yellow limes are green then the list ["apples", "bananas", "limes"] should be returned.NOTE: You may assume the file will contain no blank lines.BIG HINT: If line is a string representing a line of text (inside of a for loop!), then L = line.split() creates a list of the words in the line.arrow_forwardIn c++ Write a program that receives from the user an integer that represents the number of numbers to be entered. The program should receive that number of integers, place them in a list and display it on the screen. Subsequently, you must build a new list, with the square of each of the elements of the user's array. Tickets An integer that represents the number of integers you want to enter. Whole numbers, one in each line and according to the previous amount. Departure The list with the numbers entered by the user is printed. The created list is printed with the user's numbers squared Program execution examples >>> 5 >>> 2 >>> 4 >>> 5 >>> 8 >>> 10 [2, 4, 5, 8, 10] [4, 16, 25, 64, 100]arrow_forward
- A contact list is a place where you can store a specific contact with other associated information such as a phone number, email address, birthday, etc. Write a program that first takes in word pairs that consist of a name and a phone number (both strings), separated by a comma. That list is followed by a name, and your program should output the phone number associated with that name. Assume the search name is always in the list. Ex: If the input is: Joe, 123-5432 Linda, 983-4123 Frank, 867-5309 Frank the output is: 867-5309 461710 3116374.qx3zqy7arrow_forwardIn Python, The function add_char_counts takes three parameters: a string s and two strings of length 1, char1 and char2, and returns the total number of times either char1 or char2 appears in s. For example, the word "scallions" has 2 s's and 1 n, so add_char_counts("scallions", "s", "n") returns 3. Hint: Use a string method to help solve this problem (count). You do not need an accumulator. For example: Test Result print(add_char_counts('Indiana', 'a', 'b')) 2 print(add_char_counts('BAHAMAS', 'A', 'B')) 4 print(add_char_counts('Mississippi', 'i', 'M')) 5 print(add_char_counts("spam spam spam spam", "s", "p")) 8arrow_forwardYour math teacher has asked you to write a program that grades the multiple-choice questions in a Math exam. The exam has 10 multiple-choice questions. Here are the correct answers: 1. A 6. B 2.D 3. B 4.B 5.C 7.A 8. B 9.C 10.D Your program should store the correct answers shown above in a list. It should ask the student to enter her answers for each of the 10 questions, and the answers should be stored in another list. After the student's answers have been entered, the program should display a message indicating whether the student passed or failed the exam. (A student must correctly at least answer 7 of the 10 questions to pass the exam.) It should then display the total number of correctly answered questions, the total number of incorrectly answered questions. Your program must have at least the following functions: 1. getInput(inputList) 2. checkAnswers(userlist, correctAnswerList, rightQuestions, wrongQuestions) *. The getInput function accepts a list and asks the user to input…arrow_forward
- In Python, Using an infinite loop, enter your homework grades (enter at least 10 grades) of float data typeand append them into a grades list. Break the loop when the user enters a grade smaller than 0.arrow_forwardpls use pyhton.. thanks for answerarrow_forwardWrite in JAVA When analyzing data sets, such as data for human heights or for human weights, a common step is to adjust the data. This adjustment can be done by normalizing to values between 0 and 1, or throwing away outliers. For this program, adjust the values by dividing all values by the largest value. The input begins with an integer indicating the number of floating-point values that follow. Assume that the list will always contain fewer than 20 floating-point values. Output each floating-point value with two digits after the decimal point, which can be achieved as follows:System.out.printf("%.2f", yourValue);arrow_forward
- Please send me answer of this question immediately and i will give you like sure sirarrow_forwardPositive integers start, stop, and step have been initialized. Write code using a loop to print out all integers from start to stop in steps of step, but not including stop itself. Numbers should be separated by a space, and there should be a newline at the end of the line. It's okay if there's an extra space at the end of the line as well. For example: Test int start=0, stop=51, step=5; Result 0 5 10 15 20 25 30 35 40 45 50arrow_forwardIn Java: When analyzing data sets, such as data for human heights or for human weights, a common step is to adjust the data. This can be done by normalizing to values between 0 and 1, or throwing away outliers. For this program, adjust the values by subtracting the smallest value from all the values. The input begins with an integer indicating the number of integers that follow. Assume that the list will always contain less than 20 integers. Ex: If the input is: 5 30 50 10 70 65 the output is: 20 40 0 60 55 For coding simplicity, follow every output value by a space, even the last one. Your program must define and call a method:public static int getMinimumInt(int[] listInts, int listSize) import java.util.Scanner; public class LabProgram {/* Define your method here */ public static void main(String[] args) {/* Type your code here. */}}arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education