Day 18 of My AI & Data Mastery Journey: From Python to Generative AI

PACKAGES .

Importing a Python Package
To use a package in Python, you need to:
• Ensure the package is installed (using pip for external packages).
• Use the import statement in your script.
Standard Import Example:
python
import math # I…


This content originally appeared on DEV Community and was authored by Nitin-bhatt46

PACKAGES .

Importing a Python Package
To use a package in Python, you need to:
• Ensure the package is installed (using pip for external packages).
• Use the import statement in your script.
Standard Import Example:
python
import math # Imports the standard math package
result = math.sqrt(16)
For user-created packages or subpackages:
python
from mypackage.mymodule import myfunction
Pseudocode:
• Install the package, if external.
• Use import package_name or from package.module import item.

Importing a Less Common Package (PrettyTable)

Step 1: Install PrettyTable
bash

pip install prettytable

Step 2: Import and Use
python

from prettytable import PrettyTable

READ THE DOCUMENT AND GENRATE BELOW OUTPUT.
print(table)
OUTPUT :-

+-----------------------+------------+
| Pokemon Name         | Type       |
+----------------------+------------+
| Pikachu              | Electric   |
| Squirtle             | Water      |
| Charmander           | Fire       |
+----------------------+------------+

Pseudocode:
• Run pip install for the package (e.g., pip install prettytable)
• Use from prettytable import PrettyTable in your code
• Create table objects and operate using its methods

Coffee Machine Program Using Packages (GitHub Version Outline)
• Import logic to bring classes together.
• ALL THE PACKAGES ARE IN GITHUB.
• DOWNLOAD AND CREATE OUTPUT WHICH WE HAVE GENERATE IN PREVIOUS COFFEE_MACHINE


This content originally appeared on DEV Community and was authored by Nitin-bhatt46


Print Share Comment Cite Upload Translate Updates
APA

Nitin-bhatt46 | Sciencx (2025-10-29T04:42:00+00:00) Day 18 of My AI & Data Mastery Journey: From Python to Generative AI. Retrieved from https://www.scien.cx/2025/10/29/day-18-of-my-ai-data-mastery-journey-from-python-to-generative-ai/

MLA
" » Day 18 of My AI & Data Mastery Journey: From Python to Generative AI." Nitin-bhatt46 | Sciencx - Wednesday October 29, 2025, https://www.scien.cx/2025/10/29/day-18-of-my-ai-data-mastery-journey-from-python-to-generative-ai/
HARVARD
Nitin-bhatt46 | Sciencx Wednesday October 29, 2025 » Day 18 of My AI & Data Mastery Journey: From Python to Generative AI., viewed ,<https://www.scien.cx/2025/10/29/day-18-of-my-ai-data-mastery-journey-from-python-to-generative-ai/>
VANCOUVER
Nitin-bhatt46 | Sciencx - » Day 18 of My AI & Data Mastery Journey: From Python to Generative AI. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2025/10/29/day-18-of-my-ai-data-mastery-journey-from-python-to-generative-ai/
CHICAGO
" » Day 18 of My AI & Data Mastery Journey: From Python to Generative AI." Nitin-bhatt46 | Sciencx - Accessed . https://www.scien.cx/2025/10/29/day-18-of-my-ai-data-mastery-journey-from-python-to-generative-ai/
IEEE
" » Day 18 of My AI & Data Mastery Journey: From Python to Generative AI." Nitin-bhatt46 | Sciencx [Online]. Available: https://www.scien.cx/2025/10/29/day-18-of-my-ai-data-mastery-journey-from-python-to-generative-ai/. [Accessed: ]
rf:citation
» Day 18 of My AI & Data Mastery Journey: From Python to Generative AI | Nitin-bhatt46 | Sciencx | https://www.scien.cx/2025/10/29/day-18-of-my-ai-data-mastery-journey-from-python-to-generative-ai/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.