-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathfunctions.py
49 lines (33 loc) · 919 Bytes
/
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
43
44
45
46
# A function is a block of code which only runs when it is called. In Python, we do not use curly brackets, we use indentation with tabs or spaces
def Index():
print('hello world')
# Index()
# Index()
# Index()
# local variables globle variables
# def Index2():
# """ local"""
# print('hello django.')
""" globle"""
# print('hello django!')
# print('hello django!')
# print('hello django!')
# print('hello django!')
# Index2()
# return method
# def new_func():
# return 'hello function.'
# print(new_func().upper())
def say_hi(name, version):
# print('hello ' + name + ' the version is ' + version)
return f'hello {name} the version is {version}'
# say_hi('django', '3.2')
print(say_hi('Djano', '3.8'))
# return method 2
def new_func2(name):
return f'hello {name}'
print(new_func2('django'))
# Create function
def sayHello(name='Sam'):
print(f'Hello {name}')
sayHello()