Skip to main content
hero
Web Magazine
Braschi-Quarenghi

Time for a chat or a chat for time? Social media in our everyday lives.

  Here's the third article in our series dedicated to social media and how they affect our lives. It's Lucrezia's turn today. Scroll down and enjoy reading!   Social media has been a great way for people to connect with others around the world. However, it has also become a source of distraction for many people. While some      use social media responsibly to enhance their lives, many have become overly reliant on it. This has led to people being distracted during conversations or even losing track of their schedules, and this is one of the bad aspects about today's topic: social media.    Did you know that around 62% of the world's population use social media? While this may seem obvious, it's actually an insane percentage considering that 74% of people in the world have access to safely managed drinking water, and the small numerical difference between these two is actually very relevant in daily life, so how much do we actually need social media? what are the

Python explained with Math - Part I


Introduction

Recently more and more people are gaining interest in better understanding what a programming language really is. Today, I’m going to help you understand the basics of programming languages by explaining it with secondary school Math knowledge (functions and equation systems).

To make the job as easy as possible, I chose one of the easiest programming languages out there, which is also the one commonly used to introduce people to the coding world nowadays: Python!

Before starting: I’m “considering” all the code I’m writing as a “superset” of Math, meaning that every basic operation and operator valid in Math is also valid in Python: for example 1 + 1 is 2 and valid in Math, but also in Python, so you can use +-*/ and parentheses as normal, excluding some exceptions like ^, equal sign, parentheses different from round brackets, etcetera, but don't worry, we’re doing basic things for now!


Print

Knowing what a function is in Math, let's imagine you already defined a function called “print”, which prints (shows you, reports you, logs you) the result of the argument you passed in it.

I know, most of the time the functions you see only have a single letter as their name (ex. f), not an entire word… but it’s ok to use both in Math and programming a function with more than one letter.

Here’s the function, with some examples…

I know this function is kinda ridiculous, but it isn’t at all: differently from Math, where we calculate everything and then write down the result, a machine doesn’t know what to “tell” you after it completes all these calculations so you have to instruct it.

Notice also that I’ve already included the example of print(1+2): in fact, this is the same thing you can do in Math, by passing an expression instead of a value inside the function.

Variables


You probably encountered hundreds of them in Math problems, but I’m going to give you a (really) basic example: “Given the function f(x) = x + 1, let x be 1” (which gives 2 as result).

Ok, now let’s implement the same thing in Python, by printing the result of “x + 1”, setting x to 1…


Again, this seems obvious, but in order to get you on the computer’s side, let’s analyse the step taken:

- letting x be 1 (this is a variable! You defined x to be 1!)

- solving the steps required to get a value from the expression inside the print function, which are replacing x with the actual value, which is 1, and adding 1 + 1, which is 2

- last but not least, “writing down” (outputting) the result because print(2) is left: the result is… 2!

Now it’s your turn!


Ignore whatever it’s written there, press CTRL+A (or CMD+A) to select everything and Backspace to remove all the content. Now try writing print(1) (as in the box 1 of the image) and press the Run button (2) below the text box.

After the execution (takes about 1 sec.), you should see 1 in the output (3).
 

Now that you have a bit of manual skill with the Python Interpreter (we call the website “interpreter” as it “interprets” Python code and executes it)...

Here’s a problem for you to solve with Python:

“Let a to be 2 and b to be 3. Given y = 5a + 2b + 7, what is the value for y?”

(Tip: in Math, this would be a system of equations with 2 unknowns... that you already have!)

The solution for this problem will be in the next part of the article, coming out in May!

Today’s Blogger

Hi, I'm Giorgio Bellisario, a Liceo Scientifico student. My passion revolves around tech and everything computer-related. Coding is my favourite hobby, and I primarily focus on web development, crafting websites from scratch. If you're intrigued by all things tech and ethical "hacking", you've come to the right place.

Comments

Popular posts from this blog

5 Curiosities About Eurochocolate

  Hi, I'm Valerio and this is my first article for LET’S BLOG!, so I want to talk about something I really like and, well, almost everyone likes. What better than chocolate to have smooth start?

Celebrating 100 Years of Italo Calvino: a 20th Century Intellectual

Illustrazione digitale di Maria René Menacho, 2023, studentessa del Liceo artistico Volta di Pavia. Tecnica mista Exactly a century ago, on October 15, 1923, one of the greatest writers of the 20th century was born, destined to give us some of the richest and most complex works of 20th-century Italian literature. Italo Calvino was able to reconcile different themes and genres, blending forms and stylistic choices in a frantic attempt to give a face to the chaos of reality, ready to amaze us even today with their disarming relevance.

Welcome to the Circus!

“Welcome to the Amazing Digital Circus! My name is Caine! I’m your ring master and I’m here to show you the most jaw-dropping, heart-stopping, mind-bending paraphernalia you’ve ever laid your eyes upon!” Everyone in the Internet seems to be going crazy over an upcoming show called The Amazing Digital Circus, but what is it exactly? The Amazing Digital Circus is a computer-animated surreal black comedy and horror web series produced by Glitch Productions. It became extremely popular online as soon as the pilot was released on YouTube on October 13th. This series tells the story of six strangers that, for unknown circumstances, are trapped in a virtual world with no way of escape. We viewers get introduced to this from the point of view of Pomni, the main character, a girl that gets trapped in the Circus and, like everyone else, doesn’t remember how she got there. The main characters POMNI The main character, she is dressed as a jester with brown hair and blue and red eyes. She seems ver