144k views
1 vote
I need help on what im doing wrong

I need help on what im doing wrong-example-1
User Prasanth S
by
6.1k points

1 Answer

2 votes

Answer:

The error is that you're trying to convert a string with letters inside into an int. What happens if a user type in 'a' instead of '1'? 'a' is not a number so the int('a') would fail and give you an error. Make you add a line to check whether the input a number or not.

Step-by-step explanation:

Change your code to

DEorAP = input("Is it AP or DE?")

if DEorAP.isdigit()

DEorAP = int(DEorAP)

User Mostafa Rostami
by
4.9k points