Sunday, September 14, 2025
A- A A+

Grade Level Access and Registration

G10 Lessons

G08 Lessons

Python Codes Examples - Functions & Procedure

Article Index

FUNCTIONS & PROCEDURE

PROCEDURE example
(Mind the proper indentation, please arrange each line of code.)

#Procedure in Python:
def greet(name):
print("Hello, " + name + "!")
greet("Alice")

FUNCTION CALL example
(Mind the proper indentation, please arrange each line of code.)

# Function Call in Python that returns a value
def add_numbers(a, b):
  return a + b
# This will return a value of the function call.
print("Please enter your first number: ")
a=int(input())
print("Please enter your second number: ")
b=int(input())
result = add_numbers(a, b)
print("\nThe result is: ", result)

Copyright © 2020 - 2030 Fritz Eugene Bansag, All rights reserved.