Explore our extensive collection of courses designed to help you master various subjects and skills. Whether you're a beginner or an advanced learner, there's something here for everyone.
Join us for our free workshops, webinars, and other events to learn more about our programs and get started on your journey to becoming a developer.
For all the self-taught geeks out there, here is our content library with most of the learning materials we have produced throughout the years.
It makes sense to start learning by reading and watching videos about fundamentals and how things work.
Data Science and Machine Learning - 16 wks
Full-Stack Software Developer - 16w
Search from all Lessons
Curated list of small interactive and incremental exercises you can take to get better at any coding skill.
Curated section of projects to build while learning with simple instructions, videos, solutions, and more.
Guides on different topics related to the technologies that we teach in our courses
Javier Leyva Seiglie
The most common way to multiply 2 (or more) numbers would be using the operator (*) this is the syntax to use it:
But how could we achieve this without using this operator?
Let´s say that you dont want to use the (*) operator. Here´s the way to do it:
We created a function that receives 2 numbers, we declared a variable
result and start is as "0" to store our values and we´ll loop as many times as
num2. For each itaration result will be updated adding
num1 to the stored ammount.
The process would be pretty much alike, but the
result variable would start as 1, since we will be multiplying instead of adding and as we all know, multiplying with "0" is not a very good idea.
Multiplying strings will follow the same structure, here´s an example:
multString recevies 2 elements, the string we want to multiply and the second element will be the ammount of times it will repeat (multiply).
The way to multiply a list using the
* operator will ask to loop through the given array and multiply each element storing the value on a
result variable to return it.
Numpy is a library widely used by many programmers to handle complex mathematics operations. Here´s how to use it to multiply lists:
First we need to
import numpy to be able to use it, and then with
numpy.prod() we pass the element we want to multiply (in this case, our array of numbers)
Lambda is one of the most used methods in the python library, here´s how to use it along with
reduce to multiply lists
math library you can multiply a list of numbers, here´s an example:
We covered different ways to multiply in python numbers, strings and lists (arrays of numbers) with different methos, from the most simple and usual one, as simple as using the (*) operator, to more complex ones using libraries like
Hope you enjoyed your reading and keep on the Geek side.