Python (Level-1): Introductions

Python

Why learn computer programming?

We need to use computers and better to order computers to do something that we want.


What is a program.

A program is a list of instruction(command) for a computer.


What are the limitations of a computer?

  • can only understand simple steps and correct orders only
  • limited space
  • fast but still limited
  • seems to be accurate but is not correct

Best way to learn programming.

What's the best way to learn programming? I think that you can learn programming languages by making something by yourself. From now on, let's learn the Python language little by little while making a chatbot(chatting software robot). Python is a great language for building chatbots. You will soon find out why.

And You need to practice, practice, and practice.


Why Python?

Python is not only the most used language today, but also has the advantage of being easy for beginners to learn.

Python is more like a language of everyday life than any other language.

 if 1 in [1, 2, 3, 4]: 
 	print("There is 1.")

The above example will give you a rough idea of ​​the meaning even if you don't learn Python.


Good sites for Python learning


Others

What software to use to learn Python(Integrated Development Environment: IDE).


Let's hit the roads!

1. Introductions to Python: print( ) function, variables, input( ) function



# This is 'comment', which is starting from Sharp(#).
# Comments are statements in which information useful for explanation of code,
# and it is written regardless of program execution.

# print() function prints out 'parameters' between parentheses to the console.

# print out number 1.
print(1)

print( ) function 1: int data type

print( ) function 2: float data type and operators

print( ) function 3: string data type

print( ) function 4: multiple values, et al

### [Self-Practice] ### 


Let's study the concept of variables.
For now, let's think of a 'variable' as a 'box' that stores values
​​(in Python, this sentence is not an exact explanation, 
but for now, let's think about it like this)

It is good to make the name of the variable detailed 
so that the function/role/meaning can be understood.
Convention of variable names is to use lower_case_with_underscores.

variable 1 : variables

variable 2 : data types

variable 3 : type( ) function

variable 4 : operators

variable 5 : dynamic type binding




### [Self-Practice] ### 


Let's input a value with the input( ) function.
it performs the opposite function to the print( ) function.

input( ) function 1


input( ) function 2



### [Self-Practice] ### 


EchoBot #1
- Echobot is a chatbot that simply echo-back the user's input.
- we are using only the input() and print() functions we have learned so far.



2. Operators, Built-in functions



Operators
- arithmetic operators
- relational operators
- logical operators
- assignment operators
- membership operator
- identity operator

operators 1 : arithmetic operators

operators_2: relational operators

operators_3: logical operators

operators_4: assignment operators


operators_5: for strings


### [Self-Practice] ### 


Let's intentionally make an error.
- The best way to learn a foreign language is to make mistakes 
while talking to a native speaker.
- Computer programming is the same.
- Let's write the code that artificially generates an error below.
- Or, let's write a code that doesn't generate an error but has a strange form.

[etc]


Python has several functions that are readily available for use. 
These functions are called built-in functions. 
In this page, you will take a look at built-in functions in Python.

Quick introduction to built-in functions


### [Self-Practice] ### 



3. conditional statement(if)


In the Python language, an error occurs if columns are not aligned to the left.
- It must be written on the left.
- In other words, indentation is not allowed in the following cases.

indentation



While programming, sometimes you need to compare or check variable values.
- In this case, a conditional statement is used.
- The if statement is a typical conditional statement.

if statement


### [Self-Practice] ### 


logical operators: and, or, not
- You can check multiple conditions using logical operators.

if with logical operators


### [Self-Practice] ### 



4. loop statement: while

while loop



Comments

Popular posts from this blog

Python (Level-3): Data Types

Processing Language(Level-1): Game Coding.