DAY 4 OF PYTHON NOTES
DAY 4 OF PYTHON NOTES
๐น 1. for
Loop Basics
✅ Syntax:
-
start
: where to begin (default is 0) -
stop
: where to end (not included!) -
step
: how much to increment (default is 1)
๐น 2. Using range()
๐ Examples:
๐น 3. Pattern Printing with Loops
✅ Print 5 stars:
✅ Print stars in one line:
✅ Print triangle pattern:
๐น 4. Nested for
Loops
Used to print grids, tables, patterns, etc.
๐ Print a 3x3 grid of stars:
๐น 5. Practice Problems
-
Print first 10 even numbers using
for
loop. -
Print the multiplication table of a given number.
-
Print a square pattern of
#
of size 4x4. -
Print numbers divisible by 3 between 1 and 50.
-
Print reverse pattern:
๐ Summary
Concept | Use Case |
---|---|
for + range | Repeating with known count |
end=' ' | Print on the same line |
Nested loops | Patterns, grids, tables |
BY-ABHITECH
ReplyDeleteWow your blog sach me bahut hi lajawab hai mene adhi Jayada information apne collages ke project submit ki hai jisme ye batya gye hai compute course kitna jada benefir course hai computer ki jarurat har sector me padti hai or apko blog me article computer ke bare me maja a gye sach thanks you ese article submit karne ke liye
Graphic Designing course in Delhi NCR,
Best computer course in Delhi
Best Fine art Institute in Delhi