Part 9 | Python Programming | Creating, Importing, and Calling from Your own Module (updated)

Veröffentlicht am: 04 Januar 2023
auf dem Kanal: oOSylarTechOo
298
7

This is part 9 of a series of python coding I am having fun with and want to show others interested or stuck.

Code Example:
#Creating a custom module that you import later
#this helps to save time if use functions, lists, and other information often

#Create a function
def greeting(name):
print("Hello, " + name)

#You can also use lists
person1 = {
"name": "John",
"age": 36,
"country": "Norway"
}

#now save your file as whatever name you want to create your module

Code Example used in the Python Shell:

#import the module that you created
import mymodule as mmd

#Call on a function from within your imported Module
mmd.greeting("oOSylarOo")

#Call on a list from within your Module that pulls specific information

mmd.person1["name"]
mmd.person1["age"]
mmd.person1["country"]

#You can add as much stuff as you want to your module
#Have fun!!


#python #pythonprogramming #pythontutorial #pythonforbeginners #shorts

Music: Paid Subscription with Wondershare Filmora


Auf dieser Seite können Sie das Online-Video Part 9 | Python Programming | Creating, Importing, and Calling from Your own Module (updated) mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer oOSylarTechOo 04 Januar 2023 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 298 Mal angesehen und es wurde von 7 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!