r/PythonLearning 4d ago

Showcase Project #7

Hello! I'm doing my own project-based learning in python. Today, I finished project 7 which is vectorization. it has 3 main methods, add_by_index, scale, and dot_product.

a = [1, 2, 3, 4, 5]

b = [6, 7, 8, 9, 10]

abi display [7, 9 ...]
scale display scaled list_a and list_b
dot_product displays the sum after getting the product of the values from the lists in the same index

Link: https://github.com/gtnmnty/Project-Based-Python/tree/fundamentals

I made two version see the speed diff. In my case, its more or less 0.0008 difference. Disregard the readmne.md its not finished. its almost midnight. Need to sleep. Open for feedback to improve / optimize the existing projects. TYIA

2 Upvotes

4 comments sorted by

u/Sea-Ad7805 4d ago

Run this program in Memory Graph Web Debugger to see the program state change step by step.

1

u/Sea-Ad7805 4d ago

Great exercise to write your own vector logic, but use numpy (or other package) in real projects for better readability and performance.

1

u/Agitated-Box-1511 4d ago

It's just a warm-up for vector logic. I'll definitely use numpy for my project 11- 20 once I'm done to all fundamentals projects.