programming:python:python
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| programming:python:python [2022/11/30 10:37] – ateixeira | programming:python:python [2024/07/08 13:42] (current) – [Exercice 4 : for2] ateixeira | ||
|---|---|---|---|
| Line 56: | Line 56: | ||
| <code python> | <code python> | ||
| - | nombre = input(' | + | nombre = input(' |
| for i in range(int(nombre)): | for i in range(int(nombre)): | ||
| - | print(i+1) | + | print(i+1, end=' ') |
| </ | </ | ||
| * Then press Esc key | * Then press Esc key | ||
| Line 67: | Line 66: | ||
| < | < | ||
| python3 ex3.py | python3 ex3.py | ||
| + | </ | ||
| + | |||
| + | ===== Exercice 4 : for2 ===== | ||
| + | |||
| + | * Open a terminal | ||
| + | * Create your file by writing the following command | ||
| + | <code python> | ||
| + | vim ex4.py | ||
| + | </ | ||
| + | * Enter insertion mode by pressing Insert | ||
| + | * Write the line below | ||
| + | <code python> | ||
| + | |||
| + | nombre1 = input(' | ||
| + | nombre2 = input(' | ||
| + | |||
| + | for i in range(int(nombre1), | ||
| + | print(i, end=' | ||
| + | |||
| + | </ | ||
| + | * Then press Esc key | ||
| + | * Save the file | ||
| + | * Execute | ||
| + | < | ||
| + | python3 ex4.py | ||
| </ | </ | ||
programming/python/python.1669804623.txt.gz · Last modified: 2022/11/30 10:37 by ateixeira