fork download
  1. import msvcrt
  2.  
  3. def main():
  4. print("Multiplication: ", end="", flush=True)
  5. a = ""
  6. while True:
  7. char = msvcrt.getwch()
  8. if char == '\r': # Enter
  9. break
  10. a += char
  11. print(char, end="", flush=True)
  12. print(" * ", end="", flush=True)
  13.  
  14. b = ""
  15. while True:
  16. char = msvcrt.getwch()
  17. if char == '\r': # Enter
  18. break
  19. b += char
  20. print(char, end="", flush=True)
  21.  
  22. result = int(a) * int(b)
  23.  
  24. print(" = ", end="", flush=True)
  25. print(result, flush=True)
  26.  
  27. if __name__ == "__main__":
  28. main()
  29.  
Runtime error #stdin #stdout #stderr 0.17s 25612KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Traceback (most recent call last):
  File "./prog.py", line 1, in <module>
ModuleNotFoundError: No module named 'msvcrt'