如何将 while 循环转换为函数或过程并传入新参数 python

how to convert while loop into a function or procedure and pass in new parameters python

Motorbike_price = 3000

print("£",Motorbike_price)

while Motorbike_price > 1000:
    Motorbike_price = Motorbike_price * 0.9
    print("£",Motorbike_price)

how to convert while loop into a function or procedure and pass in new parameters python

坦率地说,最好能得到一些教程来学习像函数这样的基础。

def my_function(price):
    while price > 1000:
        price = price * 0.9
        print("£", price)

别忘了运行它

my_function(Motorbike_price)