Learning Python: Inserting to a list plus clearing - Deepstash

Bite‑sized knowledge

to upgrade

your career

Ideas from books, articles & podcasts.

Learning Python: Inserting to a list plus clearing

Learning Python: Inserting to a list plus clearing

In the image you can see i am starting with a list with three element, but if you look at the output its outputting 4, this is because i am using insert, when you use insert you need to define where you want the element to go and then the value to be placed in there, its a very simple concept to do and understand.

Next is count, this is as you would think, so in the () you enter a value that is in the list and it will output the count of all values, it wont add the elements, it just counts so you can see how many are there. Lastly we have clear which is self explanatory, it just clears the list

1

STASHED IN:

1

published ideas

🚶 On a walk

MORE IDEAS FROM THE SAME ARTICLE

Discover and save more ideas by creating a

FREE

Deepstash account.

Develop a

reading habit

, save

time

and create an amazing

knowledge library

.

GET THE APP:

MORE LIKE THIS

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...

3

STASHED IN:

8

published 1 ideas

🚶 On a walk

0 Comments

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 ca...

1

STASHED IN:

3

published 1 ideas

🚶 On a walk

0 Comments

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 ...

1

STASHED IN:

3

published 1 ideas

🚶 On a walk

0 Comments