Answer to Question #348703 in Python for siva

Question #348703

Answer to Question #341372 in Python



Note:Error is displaying in this code, please correct it

Enter the number of societies:Keep the number of people in societies:

Traceback (most recent call last):

 File "main.py", line 4, in <module>

  num_people = int(input('Keep the number of people in societies:'))

ValueError: invalid literal for int() with base 10: '\r'


1
Expert's answer
2022-06-06T15:01:09-0400
try:
    num_people = int(input('Keep the number of people in societies:'))
except ValueError:
    print('You can only enter numbers')

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS