Skip to content

EOF issue resetting during input call #1102

@microbit-matt-hillsdon

Description

@microbit-matt-hillsdon
  1. Using the program below, run it once and answer the first question
  2. Press reset on the simulator
  3. Notice that there's an immediate EOFError scrolling

After this restart doesn't work and stop seems to stop but doesn't show the play button again.

I tried a minimal program using input() and couldn't immediately reproduce it there.

# Imports go at the top
from microbit import *
import random
import music

# Code in a 'while True:' loop repeats forever
print("Welcome to my amazing times table game!")
for question in range(0, 10):
    a = random.randint(3, 12)
    b = random.randint(3, 12)
    while True:
        text = input("%s ÷ %s = " % (a * b, b))
        try:
            guess = int(text)
            break
        except:
            print("That wasn't a number!")
    if a == guess:
        audio.play(Sound.YAWN)
        print("You are awesome")
    else:
        music.play(music.BADDY)
        print("Loser :P")
    print()
    sleep(1000)
    
print("All done!")

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions