HACKINGS | Python Tutorial - 17 (argument amount). LOMBOX
Today we will learn how to add amount in an argument in a a function
We will just create a simple function -
def add_numbers (*sai):
Here I have created a def that we will add two numbers (like a calculator)
The function is said add_numbers
The argument contains *
That's because we don't know what we want to add yet.
In the future we will add a number to it.
This will make us use manymore arguments in the end. We can add as many amounts we want.
That's it. Go ahead and complete the code.
total = 0
for a in sai:
print (total)
add_numbers (45)
add_numbers (54656)
add_numbers (4565)
Now as above you can add unlimited numbers for your calculator.
you may also want these -

Komentar
Posting Komentar