# Programming teaches me how to think

Multimedia – round 3

The Python programming language is of the way that we use to solve a computer problem almost as easy as writing out your thoughts about the solution. The code can be written once and run on almost any computer without needing to change the program.

Throughout this round, I’ve learned a lot about python including Booleans, Comparisons, If statement, Elif statement, Else statement, For loop, Break statement, Continue statement, Range function, and Python while loop.

• Booleans value are the two constant objects False and True
• For example:
• “hello” is not “goodbye” – true
• 5 is 5 – true
• 1 is not 1 – false
• “one” is “one” – true
• Comparisons
• Equals: a == b
• Less than or equal to: a <= b
• Greater than: a > b
• Not Equals: a != b
• Less than: a < b
• Greater than or equal to: a >= b
• If statement
• An if statement is a programming conditional statement that, if proved true, performs a function or displays information.
• Elif statement
• The elif is a statement that allows us to check multiple expressions for TRUE and execute a block of code as soon as one of the conditions evaluates to TRUE.
• Else statement
• An else statement contains the block of code that executes if the conditional expression in the if statement resolves to 0 or a FALSE value.
• For loop
• We use For loop when we want to perform some actions a fixed number of times
• For example:
• for letter in ‘Python’:

print letter

• Out come: The code will print each letter in Python
• Break statement
• It is a statement that we use to stop the loop even if the loop is still true.
• For example

fruits = [“apple”, “banana”, “cherry”]

for x in fruits:

print(x)

if x == “banana”:

break

• Out come: apple, banana because you tell it to stop the loop when the value of it equal to banana
• Continue statement
• We use the continue statement to stop one repetition of the loop and goes onto the next repetition
• Meaning  that the continue statement is used to skip the rest of the code inside a loop for the current iteration only and continues with the next iteration of the loop.
• Range function
• We use the range function to generate sequences of numbers in the form of a list.
• For example

for x in range(6):

print(x)

• Out come: the code will print the number from 1 to 5
• Python while loop.
• While loop performs an action until the condition is False
• For example
• count = 0
while (count < 9):
print ‘The count is:’, count
count = count + 1

print “Good bye!”
• Outcome: It will perform action until is is false
• The count is: 0
The count is: 1
The count is: 2
The count is: 3
The count is: 4
The count is: 5
The count is: 6
The count is: 7
The count is: 8
Good bye!

These are what I’ve been learning with my teacher, Cindy 🙂