From 9806b921d22ea84080dcce2dec2f28f773c63f4a Mon Sep 17 00:00:00 2001 From: Now TekTalk <79338288+nowtektalk@users.noreply.github.com> Date: Fri, 25 Jul 2025 00:23:25 -0700 Subject: [PATCH] Update 03_pattern.py --- 1-hello-world/03_pattern.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/1-hello-world/03_pattern.py b/1-hello-world/03_pattern.py index 1ed538d..08e1aa2 100644 --- a/1-hello-world/03_pattern.py +++ b/1-hello-world/03_pattern.py @@ -2,3 +2,25 @@ print(' 2 3') print(' 4 5 6') print('7 8 9 10') + +#the way I coded +# Write code below 💖 + +''' +1 +2 3 +4 5 6 +7 8 9 10 +I used the for loop with enumerate function to iterate over the list +''' + +a = [1,2,3,4,5,6,7,8,9,10] +for count, item in enumerate(a,start=1): # here we are setting the index 0 as 1 + if(count == 1): + print(item) + if(count == 2): + print(item,a[count]) + if (count == 3): + print(a[count],a[count+1],a[count+2]) + if (count == 4): + print(a[count+2],a[count+3],a[count+4],a[count+5]);