This round, in Multimedia/Technology class, we focused on the basic of programming and some conditions. The language of a program that we choose was Python. The majority of the topics in this class were new to me. Before I enroll in this class, I’ve no ideas at all about the basic of Python. But now, I’ve experienced all of those a lot and I like them. The basic that I’ve discovered so far are boolean, comparisons, if elif else statement, not or and, for loop, break/continue statement, rang function, while loop, etc. In addition,
We’ve used a really wonderful website which is codeacademy.com in this class. Throughout the website, we can learn a different language and there’re exercises for us includes some basic lessons, too. Codeboard.io is also one of the websites which we use for running our code assignments and homework assignments.
# Exercise 1: Using the while loop to print the square of all number from 0 to 5.
i = 0
while i < 6:
print i ** 2
i += 1
# Output: 0 1 4 9 16 25
Example 2: Using a WHILE LOOP, print all even numbers between 0 and 50.
x = 0
while x < 50:
if x % 2 == 0:
print x
x += 1
# The output: 2 4 6 8 10 12 …. 48