I am trying to write a Program that will work out the max. profit and one function is "Steigung" which I need to work out the optimum price.
So what I have is:
def Steigung ():
Propreis=eval(raw_input("Dein hoechster Preis:"))
Satmenge=eval(raw_input("Wie viele leute werden es kaufen:"))
if Propreis >0 and Satmenge >0:
print(-1*Satmenge/Propreis)
and this works fine but what I want to do is to add the Value I specified in "Satmenge" so that the result is for example if Satmenge = 100000 and Propreis = 6 is -16666x+100000 instead of -16666 by itself and how can I store the desired result in a variable to use later? Thanks in advance
You can return multiple values in the following way:
def Steigung ():
Propreis=eval(raw_input("Dein hoechster Preis:"))
Satmenge=eval(raw_input("Wie viele leute werden es kaufen:"))
if Propreis >0 and Satmenge >0:
print(-1*Satmenge/Propreis)
return Propreis, Satmenge
And store the returned values like that:
a, b = Steigung()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.