Learning Python: ELIF statements - Deepstash
Learning Python: ELIF statements

Learning Python: ELIF statements

As you can see by the image, we are continuing with "if" statement, but this time it works different. The first "if" statement in this case is false, then thats when we get to the elif, this is another if statement just inside that if statement, if one of the elif's are true then it will stop there, execute the code insde the scope of that if statement then move on the next section of code

When it comes to elif's thet only go after a if statement, and never before there will be a error if that was to happen.

Dont forget to join the discord channel if you need help

https://discord.gg/XZQwPwaS97

2 STASHED

1 LIKE

Python: Part Nine

🚶 On a walk

Deepstash helps you become inspired, wiser and productive, through bite-sized ideas from the best articles, books and videos out there.

GET THE APP:

RELATED IDEAS

Learning Python: More on printing and variables

In this part we will be going over more on variables and printing them.

So let's make a variable and give it the value of 10, so it should look something like this X = 10, X could be any word really just not a reserved word, here is a link to a website with alot of reserved words that can't be used https://realpython.com/lessons/reserved-keywords/. 

and scroll down a little and you will see key words.

Once you have the variable made let's print the variable.

So like before very simply print(x), as you can see in the image above. Now lets run and se the output which in this case be 10.

7 STASHED

3 LIKES

Python: Part Four

🚶 On a walk

Learning Python: Basic Mathematical Operators

For todays part we, are looking at basic numerical operators. In the image i have created 2 integer variables and then in the print i have used both variables and then used the operator inbetween them, so to add them we use '+', to subtract '-', mulyply '*' and finally divide '/'.

As you can see by the outputs it has worked, so 10 + 5 = 15, 10/5 = 2. These are basic operators for python, you can perform squaring and so on but thats for future content.

Next lesson will be about what happens if you added a string and integer together.

Dont forget to join Discord for help.

3 STASHED

1 LIKE

Python: Part Five

🚶 On a walk

Learning Python: More on for loops

Just like last week i have created a for loop, but instead of only one number in the brackets.

The first number is the starting value and the second value is the highest, so in this case i have put 10, 100 so the range is 10 to 99, the last number which i put as 5, is the steps, so every 5 numbers it will do what is in the for loop. This could be any number range, plus it can go the other way aswell, so when you make the for loop in the pair of brackets put 100, 0 , -1 and it will count down instead.

For loops can also be used to iterate through lists, but that is the next lesson

Join discord

3 STASHED

1 LIKE

Python: Part Eleven

🚶 On a walk