Загрузка...

Python While Loop Example | Print Squares of Numbers from 1 to 5 🚀#Python #CodingShorts #LearnPython

In this short Python tutorial, we are printing the squares of numbers from 1 to 5 using a while loop.
The while loop is useful when you want to run code as long as a condition is true.

👉 Code used in this video:

n = 5
i = 1
while i <= n:
print(i, "→", i**2)
i += 1

📊 Output:
1 → 1
2 → 4
3 → 9
4 → 16
5 → 25

🔥 Learn Python step by step with simple examples.
✅ Subscribe for more Python coding shorts!

Видео Python While Loop Example | Print Squares of Numbers from 1 to 5 🚀#Python #CodingShorts #LearnPython канала Ansar Ahamed
Яндекс.Метрика
Все заметки Новая заметка Страницу в заметки
Страницу в закладки Мои закладки
На информационно-развлекательном портале SALDA.WS применяются cookie-файлы. Нажимая кнопку Принять, вы подтверждаете свое согласие на их использование.
О CookiesНапомнить позжеПринять