Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

python exercise Exercise 2: DMV The Department of Motor Vehicles (DMV) is responsible for issuing driver's licenses. This question asks ya write a program called

python exercise
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Exercise 2: DMV The Department of Motor Vehicles (DMV) is responsible for issuing driver's licenses. This question asks ya write a program called dmv.py that prompts the user to enter their full name (first, middle, and last) and the of birth and then produces a "driver's license". The license should have the following pieces of information: A random driver's license number that consists of 7 random digits * The users last name * The users first and middle name An expiration date which is the user's birth date except for the year which should be 2021 The first letter of the first, middle, and last name should always be capitalized (and the other letters lower cased). Here is an example of what my program produces when run: Welcome to the DV (estimated wait time is 3 hours) Please enter your first, middle, and last nase: Anthony James Mullen Enter date of birth (/D0/Y): 05/15/71 Mashington Driver License DL 8704266 LN Hullen EN Anthony Janes DOB 05/15/71 EXP 5/15/21 it Exercise 3: Number guessing game deluxe For this exercise, you willl create a more sophisticated verslon of the simple number guessing game wve looked at in class. The computer will pick a random number between 1 and 50 nclusivel and then the player will try to guess it In as few guesses as possible. Exercise 3: Number guessing game deluxe For this exercise, you will create a more sophisticated version of the simple number guessing game we looked at in class. The computer will pick a random number between 1 and 50 (inclusive), and then the player will try to guess it in as few guesses as possible. The player will enter guesses through the command line Interface, using the input function, The program will let the player know how close their guess is (if they are "hot" or "cold", and whether their guess was too high or too low). When finished, your program's output might look something like the following: Welcome to the Guessing Gane! I picked a number between 1 and 50. Try and guess! 25 You guessed 25 Your guess Is very cold 20 Your guess Is extrenely cold 40 Your guess is very warn 45 Your guess is cold 35 Your guess Is extremely wars 33 Your guess is warn 32 Your guess is ware 37 Congratulations. You igured it ut in trles. Instructions For the guessing game, use an if else block to print adifferent message dependiing on how far off the guess was Within 1 "scalding hot 13AM acer Poh Insert Saol lock F12 F1O F9 s/lab3/ Instructions For the guessing game, use an if-else block to print a different message depending on how far off the guess was: Within 1 "scalding hot" Within 2 within 3 "extremely warm "very warm Within 5 "warm Within 8 "cold" Within 13 very cold Within 20 "extremely cold" More than 20 away "cy freezing miserably cold Remember to handie both positive and negative differences! For example, if the secret number is 35, and the user guesses either 34 or 36, then they should both print out "scaliding hot Hint: There are many ways to handle this. You can elther get the absolute value of the difference, or vou can use boolean operators like and and or to check both cases. For example. 1f (age 18 and age 21)1 do sonething when you kno ag is betueen 18 and 21 elser de sonething when you kno age is outside the range of 18 to 21 Athough there are many ways to organize the conditions, some are better than others Try to keep your conditional block as simple, concise. and clear as possible. Don't forget about lif blocks You should avold writing the same print statement more than once-it makes it dificult to change the message later Debuggingg strategy: Be sure to test and retest your code at each step of the process Vou may want to temporarliy) print out the secret number so you know what you are looking for, then yoU can guess numbers that are within a certain range to test your conditionals acer Sco leck roer F12 FIO F9 else: do something when you know age is outside the range of 18 to 21 Although there are many ways to organize the condlitions, some are better than others. Try to keep your conditional block as simple, concise, and clear as possible. Don't forget about elif blocks You should avold writing the same print statement more than once-it makes it difficult to change the message later! Debugging strategy: Be sure to test and retest your code at each step of the process! You may want to (temporarily) print out the secret number so you know what you are looking for, then you can guess numbers that are within a certain range to test your conditionals. Double-check that your program works perfectly by plaving muitiple games If there is ever any behavior that seems wrong stop and figure out what caused that! Upgrading the Game (NOT required) If time allows in the lab, upgrade your program to include the following functionality 1. When the user guesses the answer correctly we now want to either mock or compliment them depending on the number of guesses it took. Recall that you already have a fheld that remembers this value Using the table below. print out the appropriate message when the guess is correct: Guesses Message to print That was lucky 2-4 That was amazing 5-6 That was okany Meh 18-9 This is not your game It0or morelYou are the worst guesser I've ever seen Th ebte tdtat 200-01-20721004392 acer foue Beack Iern Sorol Lock F12 FI FIO F9 bysig

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

Databases Illuminated

Authors: Catherine M. Ricardo, Susan D. Urban, Karen C. Davis

4th Edition

1284231585, 978-1284231588

More Books

Students also viewed these Databases questions