I want to store simple informations, like numbers in a mysql table using python. I linked my MySQL local server to PyCharm and I just don't know how to write the code in order to store the information in a table. I was thinking to use some simple "if's" and the printed result to be imediately stored in a certain table.
How can I do this?
Thanks! For starters, if I could store only the price, it would be great. Piece of my code:
    running = True
while running:
    try:
        buget = int(input("Money: "))
    except ValueError:
        print("Please enter your buget using only numbers!")
        continue
    else:
        print("Continue to the next step.")
        break
class Cars:
    def __init__(self,model,consumption,price,transmision):
        self.model = model
        self.consumption = consumption
        self.price = price
        self.transmision = transmision
        self.combination = model + " " + price
car_1 = Cars("BMW", "7%", "20000", ["Manual"])
car_2 = Cars("Audi", "8%", "30000 euro", ["Automated"])
car = (car_1, car_2)
for masini in car:
    guess = str(input("What car would you like? ").capitalize())
    if guess == "Bmw" and buget >= 20000:
        print("-----------------")
        print(car_1.model)
        print(car_1.consumption)
        print(car_1.price)
        print(",".join(car_1.transmision))
        print(car_1.combination)
    elif guess == "Audi" and buget >= 30000:
        print("-----------------")
        print(car_2.model)
        print(car_2.consumption)
        print(car_2.price)
        print(",".join(car_2.transmision))
        print(car_2.combination)
    elif guess == "Bmw" and buget < 20000:
        print("You can't afford this car.")
    elif guess == "Audi" and buget < 30000:
        print("You can't afford this car.")
    elif guess is not "Audi" and buget < 30000:
        print("This car doesn't exist!")
    elif guess is not "Bmw" and buget < 20000:
        print("This car doesn't exist.")
    else:
        print("This car is unavailable!")
    break
 
    