Home > Mobile >  How to update a variable after it's returned in a function without repetition
How to update a variable after it's returned in a function without repetition

Time:02-02

i am making a game(cookieclicker to be exact) im running of a problem of repetition so I fixed it but theirs still a problem of var not being returned, i cant seem to find a way to do it without involving repetition, here the code( just a cut of my code, which i added useful stuff like print button ) and ill tell you what I mean:

import tkinter as tk
root = tk.Tk()

def printt():
    print(amountc, amountg, amountt)

def defamountx(amount, priceconstant, cpsconstant, Name, Button, refresh):
    global cpsall
    old_price = round(priceconstant * 1.15 ** amount)
    if refresh is False:
        amount  = 1
    price = round(priceconstant * 1.15 ** amount)
    cps = amount * cpsconstant
    Button["text"] = f"{Name}\n           
  • Related