Repository navigation
Expand file tree
/
Copy path089-No-Input-No-Argument-Method.py
More file actions
57 lines (44 loc) · 1.82 KB
/
Copy path089-No-Input-No-Argument-Method.py
File metadata and controls
57 lines (44 loc) · 1.82 KB
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
47
48
49
50
51
52
53
54
55
56
57
"""
===============================================================================
File Name : 89-No-Input-No-Argument-Method.py
Description : No Input No Argument Method in Python
Author : Shaik Mahaboob Basha
===============================================================================
Definition:
A No Input No Argument Method is a method that does not take any input
(parameters) and does not return any value. It performs a specific task
whenever it is called.
Syntax:
def method_name():
# Statements
method_name()
Example:
def display_message():
print("Welcome to Python")
display_message()
"""
# -----------------------------------------------------------------------------
# Defining a method without input and without arguments.
# -----------------------------------------------------------------------------
def display_message():
# -------------------------------------------------------------------------
# Displaying a welcome message.
# -------------------------------------------------------------------------
print("Welcome to Python Programming")
# Output:
# Welcome to Python Programming
# -------------------------------------------------------------------------
# Displaying another message.
# -------------------------------------------------------------------------
print("Learning Methods in Python")
# Output:
# Learning Methods in Python
# -----------------------------------------------------------------------------
# Calling the method.
# -----------------------------------------------------------------------------
display_message()
print()
# -----------------------------------------------------------------------------
# Calling the method again.
# -----------------------------------------------------------------------------
display_message()