FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Python_Basics/python_programs/functions_main.py at master · learnbyexample/Python_Basics · GitHub
This repository was archived by the owner on Dec 29, 2020. It is now read-only.
learnbyexample
/
Python_Basics
Public archive
Notifications
You must be signed in to change notification settings
Fork
196
Star
614
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
Python_Basics
/
python_programs
/
functions_main.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
28 lines (22 loc) · 617 Bytes
Breadcrumbs
Python_Basics
/
python_programs
/
functions_main.py
Copy path
File metadata and controls
28 lines (22 loc) · 617 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
#!/usr/bin/python3
# ----- function without arguments -----
def
greeting
():
print
(
"-----------------------------"
)
print
(
" Hello World "
)
print
(
"-----------------------------"
)
# ----- function with arguments -----
def
sum_two_numbers
(
num1
,
num2
):
sum
=
num1
+
num2
print
(
"{} + {} = {}"
.
format
(
num1
,
num2
,
sum
))
# ----- function with return value -----
def
num_square
(
num
):
return
num
*
num
# ----- main -----
def
main
():
greeting
()
sum_two_numbers
(
3
,
4
)
my_num
=
3
print
(
num_square
(
2
))
print
(
num_square
(
my_num
))
if
__name__
==
"__main__"
:
main
()
Back
|
FazBrowse Home
|
New Git URL