JOIN DEVPPL

It looks like you are new here. If you want to get involved, click on Join below!



Using isinstance


M

keyboard_arrow_up
0
keyboard_arrow_down


First Post Mark as Spam mike7510uk
Posts: 4 - Registered: 2005-04-30

Hi, new to this forum(and python) and would like some help plz.
Suppose I have the following input:

prediction=input("Enter score: ")

The user should enter the score in the format "x-y", for example, 2-0 or 3-1 etc..

My problem is how to create a validation here for numbers. It obviously fails using value error because of the "-". So I`m trying to use isinstance but always getting error (never used it before). So anybody can help please????

Thanks.







MENU
Advertising