-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions_In_Python.py
42 lines (26 loc) · 947 Bytes
/
functions_In_Python.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# simple function . .
def greet():
print("Hello World !")
print("Namastey India !")
print("Annyyoungseoo Korea !")
greet()
# function that allows for inputs . .
def greet_with_name(name): # here name is parameter . .
print(f"Hello {name}!")
print(f"Namastey {name} !")
print(f"Annyyoungseoo {name} !")
greet_with_name("World") # here world is argument . .
# function with multiple inputs . .
def greeting(name, location):
print(f"Hello {name}")
print(f"located in {location}")
greeting("India", "Asia_continent")
# function with assign argument . .
def numbers(a, b, c):
print(f"a = {a} " + f" b = {b} " + f" c = {c}")
numbers(a=2, b=3, c=32)
# function with outputs . .
def format_name(f_name, l_name):
"""Take first name and last name and return title case version of name."""
return (f"{f_name.title()} {l_name.title()}")
print(format_name("taehyoung", "kim"))