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

Time:05-04

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

CodePudding user response:

Frankly, it would be better to get some tutorial to learn basis like functions.

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

and don't forget to run it

my_function(Motorbike_price)
  • Related