Q:

Better way to ask user input in integer form in Python?

So I'm kind of very beginner to programming and just learning yet the basics. Now I would like to have my python program to ask the user to give a number and keep asking with a loop if string or something else is given instead.
So this is the best I came out with:
value = False
while value == False:
    a = input("Give a number: ")
    b = 0
    c = b
    try:
        int(a)
    except ValueError:
        print("No way")
        b += 1
    if c == b:
        value = True

So is there easier and better way to do this?

A:

You can use this:
while True:
    try:
        a = int(input("Give a number: "))
        break
    except ValueError:
        print("No way")

or this:
while True:
    a = input("Give a number: ")
    if a.isdigit():
        break
    print("No way")

