Logic in Python:
if x == y:
elif y< x:
Explanation: First we declared what are “x” and “Y”. Then we start our procedure:
“if” ‘x’ is iqual to ‘y’ then print ‘success’. Because ‘x’ is not iqual to ‘y’ it will not print
‘succes’ and it will continue to the next task.
The next task is an ‘elif’ statement: ‘Then if’ ‘y’ is less than ‘x’ print ‘elif’. But, because ‘y’
is not less than ‘x’ it will not print ‘elif’ and continue to the next task”.
The last task is an ‘else’ statement: ‘if not any of that’ print ‘else’. This time the statement
is true, ‘y’ is not any of those statements so it will print ‘else’.
(The idea behind this logic is to create filters for procedures. In this case we have 3 different filters. The first one established the main qustion, the second one is a second filter to eliminate other options and the 3d one is the final result of an elimination of options.)
== iqual to
!= not iqual to
<=less than or iqual to
>=greater than or iqual to
Creating a list:
listNumbers = [1,2.,3,4,5,6]
1-We can ask if a value or string exist inside of a list:
4 in listNumbers
# Here we are asking if number ‘4’ extist inside of ‘listNumbers’. And, because it does
exist, it returns a ‘true’ value.
2- We can also add more elements to an already declared variable:
#This command when printed will return this:
3- we can also insert an item in a specific possition in the list:
#This will return the following list:
#It is adding the 9999 number in the first item of the list (item ‘0’)