Update README.md

Signed-off-by: David Rotermund <54365609+davrot@users.noreply.github.com>
This commit is contained in:
David Rotermund 2023-12-12 16:37:44 +01:00 committed by GitHub
parent cd2466bc24
commit 6b4644efdb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -73,7 +73,7 @@ print(c)
start([Start]) --> initcounter{{"counter ← 0"}} --> initcountermax{{"counter_max ← 100"}} --> Condition{"counter < counter_max"}
Condition -- Yes --> printcounter[/"print counter"/] --> Action["counter ← counter + 1"]
Action --> Condition
Condition -- No --> End(End)
Condition -- No --> stop([Stop])
</pre>
{% endraw %}
@ -95,3 +95,29 @@ while counter < counter_max:
counter += 1
```
## if, elif, else
{% raw %}
<pre class="mermaid">
flowchart TD
start([Start]) --> inputa[/"Input integer a"/] --> Condition1{"a < 1"}
Condition1 -- Yes --> print1[/"print condition 1"/]
Condition1 -- No --> Condition2{"a == 2"}
Condition2 -- Yes --> print2[/"print condition 2"/]
Condition2 -- No --> print3[/"print condition else"/]
Action1 --> stop([Stop])
Action2 --> stop
ElseAction --> stop
</pre>
{% endraw %}
```python
a = int(input())
if a < 1:
print("condition 1")
elif a == 2:
print("condition 2")
else:
print("condition else")
```