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
In Python lang.
ONE
- Generate a random number between 1 and 100. That will be the number that the user should guess. Please print the random number.
- Generate a random number by using the random.randint function
- Try several times to check that the number produced is random.
TWO: 0010
- Create a variable and ask the user to input a number.
- Ask the user to input a number in a variable that will be rewritten every time the user inserts a number and
Enforce the rules:
- Enforce that the input is a digit from 1 to 100.
- Give feedback to the user if the number needs to meet the rule.
- Allow the user to input the number again.
If the number meets the rules, convert the input [a string] into an integer and evaluate if the guessed number is the same as the randomly generated number
FOUR:
Evaluate if the randomly generated number is the same that the number input by the user.
FIVE:
- Use the dictionaries that you created for faculty members.
- Be sure that all the dictionaries have the same keys: name, last name, etc.
- If there are keys or values missing, add them. If you do not have the value, you can use 'n/a' or 'TBD'.
- Make a list of the dictionaries.
- Loop the list to print all the information available to each faculty member.
SIX:
Make a dictionary with the US states and their capitals (listed at the end of this file). The keys will be the states, the capitals will be the values. i.e. 'New York' : 'Albany'
- Use a loop to print 50 messages, one for each of the 50 states, that say:
‘Albany city is the capital of New York state.'
- Use a loop to print the 50 names of the states adding at the end the word state and a dot. Use end=.
- Use a loop to print the 50 capitals and add at the end the word city and a dot.
- Slow back the process by 2 seconds by using the time method.
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 3 steps with 2 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
- Python Programming Only Please Write a program that calculates the amount of money a person would earn over a periodof time if his or her salary is one penny the first day, two pennies the second day, andcontinues to double each day. The program should ask the user for the number of days.Display a table showing what the salary was for each day, then show the total pay at theend of the period. The output should be displayed in a dollar amount, not the number ofpennies.arrow_forwardWrite the pseudocode for a function that should accept a test score as an argument and return a letter grade for the score (as a String), based on the following grading scale: Score Letter Grade90-100 A80 - 89 B70 - 79 C60 - 69 DBelow 60 Farrow_forwardComplete the following Codearrow_forward
- Q1: complete the function that will return the multipication of 3 given numbers - a,b,c. In [ ]: def multiply_numbers(a,b,c): II II || """insert the code that performs the operation. Use the variable 'number' to hold and return the value II || || # your code here return numberarrow_forwardFizzBuzz Interview Question Create a function that takes a number as an argument and returns "Fizz", "Buzz" or "FizzBuzz". If the number is a multiple of 3 the output should be "Fizz". If the number given is a multiple of 5, the output should be "Buzz". If the number given is a multiple of both 3 and 5, the output should be "FizzBuzz". If the number is not a multiple of either 3 or 5, the number should be output on its own as shown in the examples below. The output should always be a string even if it is not a multiple of 3 or 5. Examples fizz_buzz (3) "Fizz" fizz_buzz (5) → "Buzz fizz_buzz (15) "FizzBuzz" fizz_buzz (4) "4" 11arrow_forwardHoul 4O Part E Question 1 Part E Question 2 Part E Question 3 Part E Question 4 Part E Question 5 Part F Question 6 Question 6 Write a program to calculate the perimeter of a square, a rectangle and the circumference of a circle. Ask user to key in the required details depending on their selected shape. The program will keep asking user for input unless the user enters 0 to exit. The following functions have to be used in the program: i. double square (double s); - this function will return perimeter of square ii. double rectangle (double 1, double w) ; - this function will return perimeter of rectangle iii. double circle (double r): - this function will return circumference of circle The following formulas are to be used to calculate the perimeter of a square, a triangle and the circumference of a circle: Perimeter of a square = 4s where s is the side of the square. Perimeter of a rectange = a +b +cwhere a, b and c are the sides of the rectangle. Circumference of a circle = 2 mr where…arrow_forward
- Create a function that takes a number as an argument and returns "Fizz", "Buzz" or "FizzBuzz" If the number is a multiple of 3 the output should be "Fizz" • If the number given is a multiple of 5, the output should be "Buzz" If the number given is a multiple of both 3 and 5, the output should be "FizzBuzz" ● • If the number is not a multiple of either 3 or 5, the number should be output on its own as shown in the examples below. • The output should always be a string even if it is not a multiple of 3 or 5. Examples fizz buzz (3) → "Fizz" fizz buzz (5) → "Buzz" fizz buzz (15) ➡ "FizzBuzz" fizz buzz (4) "4" (Ctrl)arrow_forwardPYTHON PTGRAMMING ONLY NEED HELP MAKING A FLOWCHART TO MATCH MY CODE CODE IS CORRECT JUST NEED HELP AKING TO FLOWCHART QUESTION, CODE, FLOWCHART EXAMPLE PROVIDED QUESTION: Write a function named max that accepts two integer values as arguments and returns thevalue that is the greater of the two. For example, if 7 and 12 are passed as arguments tothe function, the function should return 12. Use the function in a program that prompts theuser to enter two integer values. The program should display the value that is the greaterof the two. MY CODE: # Function to find the maximum of two integersdef maximum(num1, num2):return max(num1, num2)# Function to get integer input from the user with input validationdef get_integer_input(prompt):while True:try:value = int(input(prompt)) # Prompt the user for inputreturn valueexcept ValueError:print("Please enter a valid integer.") # Handle input validation# Main program logicdef main():print("Enter two integer values to find the greater of the…arrow_forwardcalcAverage function: This is function that returns no value and accept no parameters. This function will do the following: Ask the user to enter how many integers to enter. This has to be a positive integer and you need to validate that Write a “for” loop to accept this many integers and write the needed logic to calculate the average of these numbers and print that out Then the function will return back to the main functionarrow_forward
- Include pseudocode that describes all steps required to solve the problem. Employ variable names that describe the values they store and adhere to Python naming conventions. Include additional comments as needed to annotate your code. Use correct spelling and grammar. Use f_strings to output variable values. Use the "dunders test" for __name__ equals __main__ 1. Write a program that contains a main function and a custom, void function named show_larger that takes two random integers as parameters. This function should display which integer is larger and by how much. The difference must be expressed as a positive number if the random integers differ. If the random integers are the same, show_larger should handle that, too. See example outputs. In the main function, generate two random integers both in the range from 1 to 5 inclusive, and call show_larger with the integers as arguments.EXAMPLE OUTPUT 13 is larger than 1 by 2EXAMPLE OUTPUT 2The integers are equal, both are 3 2. Write a…arrow_forwardComplete the Funnyville High School registration program where user is prompted for her full name and the program generates email id and temporary password. Sample run: generate_EmailID: This function takes two arguments: the user’s first name and last name and creates and returns the email id as a string by using these rules: The email id is all lower case. email id is of the form “last.first@fhs.edu”. e.g. For "John Doe" it will be "doe.john@fhs.edu". See sample runs above. generate_Password: This function takes two arguments: the user’s first name and last name and generates and returns a temporary password as a string by using these rules. Assume that user's first and last names have at least 2 letters. The temporary password starts with the first 2 letters of the first name, made lower case. followed by a number which is the sum of the lengths of the first and last name (For example this number will be 7 for "John Doe" since length of "John" is 4 and length of "Doe" is…arrow_forwardWhen you try to access to a local variable outside the function an error is generatedSelect one:a. Falseb. Truearrow_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