paint-brush
Functions in Python—Easy or Hard to Learn & Master?by@hackernoonthreads
277 reads

Functions in Python—Easy or Hard to Learn & Master?

by HackerNoon ThreadsNovember 2nd, 2022
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

In this post, I'll give the brief intro of each 6 highly used ML packages, what is the purpose and when to use. Scikit-learn provides utilities for data preprocessing, model selection, tuning and evaluation all via a common interface of transform, fit and predict commands. Pycaret simplifies the process further by including AutoML aspects such as automated data preprocessing and model selection. Keras markets itself as ‘an API designed for human beings, not machines” and is a high-level wrapper for interacting with TensorFlow.

Company Mentioned

Mention Thumbnail
featured image - Functions in Python—Easy or Hard to Learn & Master?
HackerNoon Threads HackerNoon profile picture

This thread was originally published by Stephen Gruppetta


In this post, I'll look at aspects of functions which can be tricky for those who know basics and want to move to next level Let's start with the unexciting but important—terms.

  • Define
  • Call
  • Parameter
  • Argument



Here's the code we'll use as an example which you can also get from the ALT text of the image in the first tweet:


``` def greet_person(person): print(f"Hello {person}! How are you doing today?")


greet_person("Ishaan") greet_person("Elizabeth")


1. Define

You define the function when you use the `def` keyword The first line of the definition is the function signature and the code after the colon is the code you want the function to perform. However, this code does not run when you define a function For this, we need to call the function.


2. Call

You call a function when you use it You're calling a function when you write its name followed by parenthesis (the round brackets). The code in the function definition will run when you call a function. In the example above, you're calling the function twice on the last two lines of the code.


3. Parameter

A parameteris the name you choose for information that's needed by the function. You add parameters inside the brackets in the function signature which is the line which includes `def`
In this example, the parameter is `person` This is the name of the "storage box" which is ready to hold any information you send into the function However, when you define the function, this "box" is still empty.


4. Argument

An argument is the actual information you send to a function when you call it You called the function twice in the example above The first time you called `greet_person()` you used the argument `"Ishaan"` and the second time `"Elizabeth"`. When you call the function, the information (the argument) is stored in a variable named `person` inside the function Don't worry too much if you confuse parameters and arguments. Many programmers confuse them, too!


"What's in a name?", one might argue? And there's a point. What matters most is knowing how to use concepts rather than knowing the precise definitions Still, these terms are used everywhere-in documentation, in tutorials, when talking to other programmers.


So, knowing the terminology isimportant. It shouldn't be the first thing someone learns, but eventually, everyone should become familiar with the right terms for the right things

Originally published here.