90% of our coding now on is going to be be "for loop" coding.
Check out my little code:
# Exercise 2 : Control Flow and Looping
"""
Loop through list a and only print out the even numbers.
"""
a = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
for realnumbers in a:
if realnumbers % 2 ==0:
print realnumbers
Koikoi's Python Page
Thursday 6 June 2013
Friday 31 May 2013
THE LAST DAY AT BEGGINER
LIST
In Python, a list stores a collection of different pieces of information as a sequence under a single variable name.
Check out this little code.
suitcase = []
suitcase.append("sunglasses")
# Append 3 more items to the suitcase
suitcase.append("hat")
suitcase.append("shorts")
suitcase.append("shoes")
suitcase.append("camera")
suitcase.append("shaver")
suitcase.append("Tablet")
# Create a variable called list_length and assign it to the length of suitcase
list_length=len(suitcase)
print "There are %d items in the suitcase." % list_length
print suitcase
suitcase.append("sunglasses")
# Append 3 more items to the suitcase
suitcase.append("hat")
suitcase.append("shorts")
suitcase.append("shoes")
suitcase.append("camera")
suitcase.append("shaver")
suitcase.append("Tablet")
# Create a variable called list_length and assign it to the length of suitcase
list_length=len(suitcase)
print "There are %d items in the suitcase." % list_length
print suitcase
Wednesday 22 May 2013
Fourth Day at Pythons
Today at the Beginner for Python, there were four interesting techniques discovered.
The most difficult thing learned today was simplifying the comparators with digits or integers. That was a brain teaser.
The easiest think today was simplifying True of False in words (True or False).
I think conditional can be used for a program calculating harvest per yield program.
- Control Flow
- Comparators
- Boolean Operators
The most difficult thing learned today was simplifying the comparators with digits or integers. That was a brain teaser.
The easiest think today was simplifying True of False in words (True or False).
I think conditional can be used for a program calculating harvest per yield program.
Monday 20 May 2013
Third Day At Python's
Today's Exercises
At Beginner in Python today, there was a couple of new techniques learned.
Math Operations
This is learning how to do basic math opereation with the Python programming language. It is really symple. Check this codes:
number=2+1
print number
This code adds the sum of two integers.
Tip Calculator
This is a kind of calculator that give you the exact tip to be given at a restaurant. So it means you don't have to worry. Check this sample:
meal=44.50
tax=0.0675
tax=0.0675
# The tip for this restaurant is 15%
tip=0.15
meal=meal+meal*tax
#Print the results
total=meal+meal*tip
print total
meal=meal+meal*tax
#Print the results
total=meal+meal*tip
print total
String
A string is a
Friday 17 May 2013
Second Day At Python's
What was Learned Today?
The kind of programme I wrote is variable oriented.
- One of the topics was Variables &Data Types. A variable is anything (word) that stores a value. Data types are the kinds of variables. There are different data types are as follows: string (word type), float, boolean( a kind of only True or False value) and integer (a whole number value).
- Another think learned was Whitespaces and Statements affect a program. Whitespaces are spaces that shouldn't be left in a line of code. On the other hand, statements are specific ways that a code is written in terms of structure and position. Example: name = Mulbah
- Comments are lines of words that is only meant for the human programmer to understand. Comments either start with # or ".
The kind of programme I wrote is variable oriented.
Wednesday 15 May 2013
My First Experience in Python Trainning
- Introduction
I have no siblings, meaning I am the only child of my parent.
AT spare time, I love doing graph art.
After learning python, I could write programmes for mobile phone.
- Check Out first Code
print"Hello%s!" % name
colour=raw_input ("what is your favorite colour? ")
print "Good Colour%s!" % colour
Subscribe to:
Posts (Atom)