Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1) Write a Python program to play a basic game: user guesses a number, and the program compares it to a randomly generated number to

1) Write a Python program to play a basic game: user guesses a number, and the program compares it to a randomly generated number to see if they match. Use the following steps:

**Note: Double click this cell to see the pseudocode formatted with indentations.

Prompt the user for his or her name and get the and store it in a variable called player_name. If the name is blank, print a message and exit. Print a welcome message to the user that includes his or her name. Prompt the user to guess a number between 0 and 100; store it as an int in a variable called user_number. Import the random library, then generate a random integer between 0 and 100, and store it in a variable called computer_number. If user_number is less than computer_number, print Sorry, [insert player_name]. You guessed too low! [insert user_number] is less than [insert computer_number]. If user_number is equal to computer_number, print Correct, [insert player_name]! You guessed that I am thinking of the number [insert computer_number]. If user_number is greater than computer_number, print Sorry, [insert player_name]! Your guess is too high! [insert user_number] is higher than [insert computer_number].

2)

Write pseudocode and Python code for a program that takes the user's age as input and prints a ticket price (depending on their age)

A movie theater charges different ticket prices depending on a persons age. If a person is under the age of 3, the ticket is free; if they are between 3 and 12, the ticket is $10; and if they are over age 12, the ticket is $15. Write a program in which you ask users their age, and tell them the cost of their movie ticket.

In your code, the prompt for the user's age should be "What is your age?", and the output should be of the form "Please pay $amount for the ticket."

3)

Q6 (5 pt) Write a Python program to calculate the product of three user-generated numbers (ints or floats) and tell you the result, and whether the product is even or odd.

Example inputs and desired outputs:

Example 1

Inputs

a = 2 b = 3 c = 7 

Desired output(s):

42 Even 

Example 2

Inputs

a = 5 b = 3 c = 3 

Desired output(s):

45 Odd

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design Application And Administration

Authors: Michael Mannino, Michael V. Mannino

2nd Edition

0072880678, 9780072880670

More Books

Students also viewed these Databases questions

Question

=+4 What are non-union workers representations?

Answered: 1 week ago