while True:
def calc_GUGUDAN(dan):
for i in range(1, 10):
print (input_data, "X", i, "=", input_data*i)
input_data=int (input ("enter")
if input_data>=1 and input_data<=9:
calc_GUGUDAN(input_data)
else:
print("Calculate only numbers from 1 to 9."")
It's a program that runs multiplication tables by receiving one of the numbers from 1 to 9, and I want to end the repetition by typing F, how can I do it?
python
If you enter F
in int(input("..")
, an error will occur. Therefore, you can divide the conversion into two processes: input
and int
.
input_str=input("Enter a stage")
## Check if input_str is 'F' and exit.
input_data = int(input_str)
© 2024 OneMinuteCode. All rights reserved.