# python程式與資安實務
## :memo: Where do I start?
### :pushpin: 01-1變數
程式中的變數主要用於儲存使用者輸入資料,並隨程式執行,其儲存內容亦會隨之改變,故稱之為變數。
1. 變數命名規則
* 由**英文**、**數字**、**底線**組成
* ==不==得以==數字==開頭
* 不能與Python內建的保留字相同
2. 變數指派語法:==變數名稱 = 指派值==
* 範例:==a, b = 3.14, “TAINAN”==
* 說明:a指派為3.14(浮點數),b指派為TAINAN(字串)
### :pushpin:01-2 輸入輸出
使用Python內建函數
:memo:輸入 input()
:memo:輸出 print()
1. 輸入語法:==變數 = input( [提示字串] )==
* 範例:==a = input()==
* 說明:將使用者輸入資料存於變數 a
* 註:input() 讀入含空白的整行文字
**若要轉整數,可使用 int() 函數**
如:==a = int( input() )==
2. 輸出語法:==print( [項目1, 項目2, ...] )==
* 範例:==print(a)==
* 說明:將變數 a 內容印出,印完換行
### :pushpin:01-3 運算子
俗稱運算符號,區分為
:memo: 算術運算子
:memo: 關係運算子
:memo: 邏輯運算子
:memo: 運算式規則:變數 = 運算式
運算式規則:==變數 = 運算式==
範例:==sum = ((a+b)*3+c*4) / 10==
說明:將等號右邊結果存於變數 sum
算術運算子:==+, -, *, /, %, //, **==
關係運算子: >, <, >=, <=, ==, !=
邏輯運算子:==and, or, not==
| 算術運算子 | 意義 | 關係運算子 | 意義 |
| ---------- | -------- |:----------:|:----:|
| + | 加 |> | 大於 |
| - | 減 | < | 小於 |
| * | 乘 | >= | 大於等於 |
| / | 除 | <= |小於等於 |
| % | 餘數運算 | == | 等於(比較) |
| // | 商數運算 | != | 不等於 |
| ** | 指數運算 | | 大於 |
### if用法
%:除取於
- [ ] 小數可以用嗎?
- [x] 3%5=3
if(80>a>=70)
- [x] python
- [ ] c/c++
因為c++會先執行80>a執行出的結果為0或1最後結果不成立
課程

:rocket:

### Step 2: Write something in Markdown
Let's try it out!
Apply different styling to this paragraph:
**HackMD gets everyone on the same page with Markdown.** ==Real-time collaborate on any documentation in markdown.== Capture fleeting ideas and formalize tribal knowledge.
- [x] **Bold**
- [ ] *Italic*
- [ ] Super^script^
- [ ] Sub~script~
- [ ] ~~Crossed~~
- [x] ==Highlight==
:::info
:bulb: **Hint:** You can also apply styling from the toolbar at the top :arrow_upper_left: of the editing area.

:::
> Drag-n-drop image from your file system to the editor to paste it!
### Step 3: Invite your team to collaborate!
Click on the <i class="fa fa-share-alt"></i> **Sharing** menu :arrow_upper_right: and invite your team to collaborate on this note!

- [ ] Register and sign-in to HackMD (to use advanced features :tada: )
- [ ] Set Permalink for this note
- [ ] Copy and share the link with your team
:::info
:pushpin: Want to learn more? ➜ [HackMD Tutorials](https://hackmd.io/c/tutorials)
:::
---
## BONUS: More cool ways to HackMD!
- Table
| Features | Tutorials |
| ----------------- |:----------------------- |
| GitHub Sync | [:link:][GitHub-Sync] |
| Browser Extension | [:link:][HackMD-it] |
| Book Mode | [:link:][Book-mode] |
| Slide Mode | [:link:][Slide-mode] |
| Share & Publish | [:link:][Share-Publish] |
[GitHub-Sync]: https://hackmd.io/c/tutorials/%2Fs%2Flink-with-github
[HackMD-it]: https://hackmd.io/c/tutorials/%2Fs%2Fhackmd-it
[Book-mode]: https://hackmd.io/c/tutorials/%2Fs%2Fhow-to-create-book
[Slide-mode]: https://hackmd.io/c/tutorials/%2Fs%2Fhow-to-create-slide-deck
[Share-Publish]: https://hackmd.io/c/tutorials/%2Fs%2Fhow-to-publish-note
- LaTeX for formulas
$$
x = {-b \pm \sqrt{b^2-4ac} \over 2a}
$$
- Code block with color and line numbers:
```javascript=16
var s = "JavaScript syntax highlighting";
alert(s);
```
- UML diagrams
```sequence
Alice->Bob: Hello Bob, how are you?
Note right of Bob: Bob thinks
Bob-->Alice: I am good thanks!
Note left of Alice: Alice responds
Alice->Bob: Where have you been?
```
- Auto-generated Table of Content
[ToC]
> Leave in-line comments! [color=#3b75c6]
- Embed YouTube Videos
{%youtube PJuNmlE74BQ %}
> Put your cursor right behind an empty bracket {} :arrow_left: and see all your choices.
- And MORE ➜ [HackMD Tutorials](https://hackmd.io/c/tutorials)
