-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathgreet_functions.py
42 lines (29 loc) · 1.03 KB
/
greet_functions.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
def say_hello():
print("Hello World!!!")
print("Goodbye World!!!")
def create_greeting_message(name):
# declare a variable called message and
# assign to it the concatenated result of 'Hello' and a name
message = "Hello " + name
# use the return keyword to hand an output to the caller
return message
# The * represents a variadic parameter
def greet_many(*names):
print(names)
print(type(names))
def test_my_functions():
# test my functions
say_hello()
say_hello()
say_hello()
# declare a greeting variable and assign to it the created greeting message (function call)
greeting = create_greeting_message("Nihal")
# output the string to the standard output stream
print(greeting)
# output the string as uppercase (uses a method) to the standard output stream
print(greeting.upper())
greet_many("James", "Dom", "Kamil")
print("My __name__ is", __name__, " I am the greet_functions file")
if __name__ == "__main__":
test_my_functions()
print(__name__)