---
# System prepended metadata

title: 'Week 11: Functions in Python'

---

### Week 11: Functions in Python
This week, we were introduced to functions which was defined as a reusable piece of code that is made to perform a specific task.
 
 Example:
 
 ```python
def add():
    x = int(input("enter first number: "))
    y = int(input("enter second number"))
    total = x + y
    print(total)
add()
```
The above function takes no argument but when called like it is n the last line of code, performs task in the function block.

Example:

```python!
text = input("enter a text: ")
def vowel_sound(text, vowels = "aeiou"):
    vowels_in text = 0
    for character in text:
        if character in vowels:
            vowels_in_text += 1
    print(vowels_in_text)
vowel_sound(text, vowels = "aeiou")
```

The above function takes two arguments of a text input of a string and a variable that has a string value of vowel sounds. The function block is meant to print out number of vowel sounds from a user input when the function is called like it was on the last line of code.

### CONCLUSION

We didn't do much aside the introduction to function, how it is defined and called to action and that's because of the activities surrounding the prodfest which is a web3 event organized by the hub i attend but with that out of the way now, i am looking forward to doing more with functions. 