#!/usr/bin/python3
# ==================================================================
# From: https://www.youtube.com/watch?v=lOeIDvyRUQs
#
# Summary of Best Proctices
# 1. Put code that takes a long time to run or has other effects
# on the computer in a function or class, so you can control
# exactly when that code is executed
# 2. Use the different values of __name__ to determine the context
# and change the behavior of your code with conditional
# statements
# 3. Name the entry point function main() in order to communicate
# the intention of the function, even though Python does not
# assign any significance to a function names main()
# 4. If you want to reuse functionallity from your code, define
# the logic in functions outside main() and call thoes function
# within main()
# ==================================================================
from time import sleep
print("This is my file to demonstrate best practices.")
def process_data(data):
print("Begining data processing...")
modified_data = data + " that has been modified"
sleep(3)
print("Data processing finshed")
return modified_data
def main():
data = "My data read from the web"
print(data)
modified_data = process_data(data)
print(modified_data)
if __name__ == "__main__":
main()