If

First declare variables
if1if2

This cant be printed, because the if only executes the action when its true.

And now, a if that can be printed because its true.

if3if4

You can add variables, more conditions.

if5if6

Source: https://www.youtube.com/watch?v=4u2ClNCtcgY&list=PLQVvvaa0QuDe8XSftW-RAxdo6OmaeL85M&index=8

 

More loops, loops everywhere, FOR LOOP.

giphy
Me when i see a loop

Welcome to another post, and another loop.

In this case we explain the FOR loop. The for loop is used for the same things as the While Loop, but the for loop is for finite loops.

You can use Lists.

untitleduntitled2

If you put, for example the print («A value») into the loop, the words «A value» can be printed with every number.

f3f4

Range function.

f5f6

If you put a third number in the (), this number activates a function that says steps of 2 in the range.

f7f8

And you can use slices (strings) for the for loops.

f9f10

Source: https://www.youtube.com/watch?v=xtXexPSfcZg&list=PLQVvvaa0QuDe8XSftW-RAxdo6OmaeL85M&index=7

 

 

Lists

ingredients-list-icon-icon-search-engine-10In this blog we introduce to create lists on python 3.

With a list you can use to group values.The list can be written as a list of comma-separated values (items) between square brackets.

l1l2

Indexing.

l3l4

Adding items.

l5l6

Changing the value of a character from the list.

l7l8

Append function, add items at the end of the list.

l9l10

Using slices to change values.

l11l12

Len function, counts how many items are in the list.

l13l14

Source: https://docs.python.org/3/tutorial/introduction.html