Python (Level-1): Introductions
Why learn computer programming?
We need to use computers and better to order computers to do something that we want.
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.
- can only understand simple steps and correct orders only
- limited space
- fast but still limited
- seems to be accurate but is not correct
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
- beginner:
- https://open.cs.uwaterloo.ca/
- Trinket.io
- Lecture contents: https://docs.trinket.io/getting-started-with-python#/welcome/where-we-ll-go
- Editor: https://trinket.io/
- https://www.w3schools.com/python/default.asp
- https://www.learneroo.com/modules/65/nodes/366
- https://towardsdatascience.com/how-to-learn-python-coding-9f096d70c22d
- https://www.learnpython.org/
- https://www.geeksforgeeks.org/python-programming-language/?ref=shm
- https://docs.python.org/3/contents.html
- (in Korean)
- https://wikidocs.net/ (in Korean)
- https://dojang.io/course/view.php?id=7 (in Korean)
- coding practice
- beginner:
- a little difficult:
Others
Chatbot:
Discord
- How to install pip on MAC: https://www.geeksforgeeks.org/how-to-install-pip-in-macos/
- Discord Bot: https://realpython.com/how-to-make-a-discord-bot-python/
- Discord Bot Examples: https://lektion-von-erfolglosigkeit.tistory.com/85?category=955777
- Discord Bot Hosting@ Heroku:
What software to use to learn Python(Integrated Development Environment: IDE).
- We will use Visual Studio Code(VS Code) later when you are used to Python. VScode is currently the most used editor by developers.
- Later, we will use Colab.
- https://colab.research.google.com/
- [how to use]
- But, as a beginner,
- https://trinket.io/console
- https://replit.com/languages/python3
- you can save your source code files at this site.
- https://www.programiz.com/python-programming/online-compiler/
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.
### [Self-Practice] ###
Let's input a value with the input( ) function.
it performs the opposite function to the print( ) function.
### [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.
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.
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.
### [Self-Practice] ###
logical operators: and, or, not
- You can check multiple conditions using logical operators.
### [Self-Practice] ###
Comments
Post a Comment