or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Syncing
xxxxxxxxxx
Learning python (general usage)
For the beginners who have learned a little bit of programming. Even Excel will help.
Lesson 1
Environment Setup
Install the 2 IDEs (Integrated Development Environment) below.
Download Python3.X.X. Do not download Python2.X.X.
Light weight.
Use "python IDLE" to test and run the code.
A fancy IDE which has autocomplet and many useful features. There are 2 versions: one is Professional, and the other is Community. Please download the Community.
Online environment
https://repl.it/languages/python3
Some useful links if you want to learn online
https://www.codeschool.com/courses/try-python
https://www.learnpython.org/
Solving problems in detail steps with variables, if-else statement, and looping.
Ex. 1: Calculate the average of several numbers.
Ex. 2: Is x a prime:
(assume the x is an integer)
Ex. 3: Count the number of each letter in an English article.
Ex. 4: Make a histogram for the scores of the students in a class.
Ex. 5: Part of "master mind" - guess 1234 for answer 1357
Python code for Ex.2
Small Test
A kid filled all the grids of a Sudoku, but does not know if it is correct.
How do you use your word to discribe the Sudoku rule?
Summary
Think a problem with your own language first. Then try to transform the idea into pseudo code, which uses variables, if-else, and looping. Finally, transform the pseudo code into the target programming language. Don't worry about the last step. You will learn how to code in Python after this lesson.
Lesson 2
Basic input
Basic output
Basic objects: integer, float, string, None
Advanced print (https://pyformat.info/)
Conditional statement: if-else, if-elif-else
Basic logic operator: <, <=, ==, >=, >
Loop statement: for, while, continue, break
Small Tests
Q1: Print
Q2: Print
Q3: Let user input an integer N. Output the avg of summation(1~N).
Q4: a, b = 10, 20, please swap the value of a and b
Q5: Print 99 multiplication table with some alignment.
Q6: List the primes <= the user input number N. For example, if user input is 19. List 2,3,5,7,11,13,17,19.
Q7: Print the first 20 Fabonacci numbers from 0,1,…