mardi 31 août 2021

How do I subtract a number with an if statement

This is my code

import sys
import click


def Seats():
    global seats
    seats = 168
    print("\nThe current seating capacity is {}\n".format(seats))


def Restart():
    while True:
        restart = click.confirm('\nWould you like to subtract 1 from seats?',
                                default=True)

        if restart == True:
            x = seats - 1
            Seats()
        elif restart == False:
            print("\nOk, see you next time!\n")
            sys.exit()


Seats()
Restart()

I want to ask the user "Would you like to subtract 1 from seats?" and then subtract one from seats variable and then repeat until the users inputs n.

Aucun commentaire:

Enregistrer un commentaire