Python Default Error

Asked 2 years ago, Updated 2 years ago, 51 views

try:
    print("This is a single-digit calculator.")
    num1 = int (input ("Enter the first digit :")
    num2 = int (input ("Enter the second digit :")
    print("{0} / {1} = {2}".format(num1, num2, int(num1/num2)))
except ValueError:
    print("Please enter a single digit number.")
except ZeroDivisionError as err:
    print(err)

I'm a beginner at Python. I'm practicing the code above num1 The color does not equal num2.

I touched the linting in setting, Should I touch the settings? Is the code grammar wrong?

python error

2022-09-20 19:09

1 Answers

You have to check the number of brackets properly.

# Example
num1 = int (input ("Enter the first digit :")
=>
num1 = int (input ("Enter the first digit : ")))


2022-09-20 19:09

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.