Thursday, April 9, 2015

Python ( Programming Language)

Python
is a programming language and it can be use in different applications.
It is easy to learn that's why it is used as an introductory programming language.

Objects
the core things in which a python program manipulate
scalar objects: int, float, bool (true or false), none (null) *scalar objects means atomic objects
non-scalar objects: strings, structures *it is a set of elements

Variables
are the temporary holders of values
case-sensitive
assignment operation is from right to left
e.g  person0= Ei-chan

Operators
is a program element that is applied to one or more operands in an expression or statement.

Expressions
objects + operators
evaluation follows PEMDAS

Comments
'#' for single line comments '''<multi-line comments>'''

Running Python
interactive interpreter ( in terminal to exit  Ctrl+D)
when finished creating program in text editor save it as .py(file extension of python)

Basic Input/Output
print is used to show the values on the terminal and use the input to ask values from the user

eg. print("Hello World!")
yourage= input("what is your age")

Iterative Statements
WHILE LOOP: while body keeps on repeating as long as the condition is true.

while(condition):                                       if(condition):
<indent>while_body                                 <indent>if_body

Conditional Statements                              elif(condition):
IF-ELIF-ELSE                                           <indent>elif_body

else(condition):
<indent>else_body

No comments:

Post a Comment