# Condition Statement

ใน python มี if-else ในการเลือกการตัดสินใจ มี syntax ดังนี้

* แบบทางเดียว

```python
if (consition):
  <statement>
```

* แบบสองทาง

```python
if (consition):
  <statement>
else:    
  <statement>
```

* แบบหลายทาง

```python
if (condition):
  <statement>
elif (condition):   
  <statement>
else:    
  <statement>
```

#### มาลองทำดูดีกว่า

เขียนโปรแกรมตัดเกรดกันเถอะ ...

การตัดเกรดของวิชาการเรียน python พื้นฐาน มีเกณฑ์ ดังนี้

100 = A+, >=80 = A, >=70 = B, >=60 = C, >=50 = D, other = F

มาลงโค้ดดิ้งกัน

ให้ input มีชื่อตัวแปรว่า score และ output ชื่อว่า `grade`

```python
# input student score
score = 78

if (score == 100):
  grade = "A+"
elif ((score >= 80) and (score < 100)):
  grade = "A"
elif ((score >= 70) and (score < 80)):
  grade = "B"
elif ((score >= 60) and (score < 70)):
  grade = "C"
elif ((score >= 50) and (score < 60)):
  grade = "D"
else:
  grade = "F"

print (grade)
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mikkicoding.mikkipastel.com/python-for-beginner/06-python-condition-statement.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
