Gallery
Solution Debug 4.2. Mind Reader
Share
Explore
Solution Debug 4.2. Mind Reader

icon picker
Solution

At the right hand side is the the task, starter code and code clips that pupils got.
Below is a link to the solution. You can right click open on replit to demo the answer to pupils and talk through the code.
solution

import time

# prints a blank line
print('\n')
print('I am going to read your mind!')
# prints a blank line
print('\n')
# ask user for a number 1-9
mysteryNumber = int(input('Think of a mystery number 1-9, type it in: '))
# prints a blank line
print('\n')
# Tell them to start the answer by adding the mystery number to itself.
print('Add your number to itself')
answer = mysteryNumber + mysteryNumber
time.sleep(5)
print(' . . still reading your mind . .\n\n')
time.sleep(5)

# Ask them to multiply the new number by 5.
print('Multiply the new number by 5')
answer = answer * 5
time.sleep(5)
print(' . . still reading your mind . .\n\n')
time.sleep(5)
# Tell them divide their current number by their original number.
print('Divide the current number by the original number')
answer = answer / mysteryNumber
time.sleep(5)
print(' . . still reading your mind . .\n\n')
time.sleep(5)
# Now say subtract 7 from their current number.
print('Subtract 7 from the current number')
answer = answer - 7
time.sleep(5)
print(' . . still reading your mind . .\n\n')
time.sleep(5)

# prints a blank line
print('\n')
# display addition sum and answer
print('The answer should be ' + str(answer) + ' !!!!')
Share
 
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.