Q:

How to add a number to int when in loop in Python

So i am new to programming in general and i am trying to make a number guessing system so it would give you 7 tries and how many tries you had at the end when the number was guessed
tried already doing this
    if c < z:
        print('Higher')
        print('Tries ' + str(count) + '/7')
        count += 1
        this()

but it didn't work. Some advice would be much appreciated.
Code:
count = 1
z = random.randint(1, 100)

def this():

    inpt = input('Enter a Number: ')
    c = int(inpt)

    if c >= 101:
        print('Number too high only 1-100')
        this()

    if c <= 0:
        print('Number too low only 1-100')
        this()

    if c > z:
        print('Lower')
        print('Tries ' + str(count) + '/7')
        this()

    if c < z:
        print('Higher')
        print('Tries ' + str(count) + '/7')
        this()

    if c == z:
        print('Success! You guessed the number')
        quit(0)

this()

if count == 7:
    print('You lose!')
    quit(1)

A:

If you don't want to do it calling the same method name over again and literally just need a loop to go a certain number of times you can do something like this:
count = 0
guesses_allowed = 7
number_to_guess = 5

while (count < 7):
    guess = input("Guess a number:")

    if guess >= 101:
        print('Number too high only 1-100')
    elif guess <= 0:
        print('Number too low only 1-100')
    elif guess > number_to_guess:
        print('Lower')
        count += 1
        print('Tries ' + str(count) + '/7')
    elif guess < number_to_guess:
        print('Higher')
        count += 1
        print('Tries ' + str(count) + '/7')

    if count >= guesses_allowed:
        print('You guessed too many times')
        quit(0)

    if guess == number_to_guess:
        print('Success! You guessed the number')
        quit(0)

And then modify as needed for changing the number_to_guess or the guesses_allowed variable.  Haven't ran this code locally yet as I just typed it out but it should get you most of the way there.

