Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#Let's look at how to make decisions in Python # We are going to create a guessing game ########################## Challenge 1 ################################ # Variable assignment

#Let's look at how to make decisions in Python # We are going to create a guessing game ########################## Challenge 1 ################################ # Variable assignment # Assign a secret number to a variable # Assign a variable to an input statement asking a user to input a guess between a range of numbers of which your secret number is included """ Expected Output Please enter a guess number between 0 and 100: """ ## Challenge 1 Code below ################## ########################## Challenge 2 ################################ # Comparing the input and the secret number. # Since this is a simple comparision of two numbers, we can use if / else to compare them # if your number equals the secret number, print a message letting the user know the numbers match. # if the number does not equal the secret number, let the user know their guess was incorect """ Expected output given my secret number is 53 Please enter a guess number between 0 and 100: 50 Sorry your guess did not match the number """ ## Challenge 2 & 3 Code below ################## ########################## Challenge 3 ################################ ## So the program doesn't exactly work, specifically if the guess matches the secret number # the program still puts out the message that the numbers do not match. # What is the issue? #fix the code so the if statementfunctions correctly # HINT: Look into the functions input(), What is the type of data for an input variable? """ Expected Output Please enter a guess number between 0 and 100: 53 Congratulations, the numbers matched Great job!! """ ########################## Challenge 4 ################################ ### Now it is your turn, create code which will determine the letter grade of an inoutted grade """ This is the grade ranges we are using in the program 90.0-100 A 80.0-89.9 B 70.0-79.9 C 60.0-69.9 D 00.0-59.9 F Expected Output Please enter a grade to analyze. This can be a whole number or a decimal: 92 92.0 is an A """ ## Challenge 4 Code below ################## ########################## Challenge 5 ################################ # Let's play with some string #using the string alphabet below, Ask a user to enter a number and your program will display the letter in the alphabet # which corresponds to the number ##HINT: be careful of how to select a character. Test it with the number 1, did the correct letter appear? """ Expected output Please enter number to find out the corresponding letter in the alphabet:1 The letter in position 1 is a """ alphabet = 'abcdefghijklmnopqrstuvwxyz' ## Challenge 5 Code below ################## ########################## Challenge 6 ################################ #Now take the code from above and modify it to ask the user the starting position and how many characters after the starting to show # HINT: remember the offset in slicing, the second value is the stop position, not the length """ Expected Output Please enter number to find out the corresponding letter in the alphabet:5 Please enter number of letters to display in a row:10 The letter in position starting at 5 and continuing for 10 is efghijklmn """ ## Challenge 6 Code below ##################

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

1st Edition

0763733148, 978-0763733148

More Books

Students also viewed these Databases questions