We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 91e3557 commit 554c6f6Copy full SHA for 554c6f6
2 files changed
codes_in_Aug2025/Advance python/enumerate.py
@@ -0,0 +1,15 @@
1
+l = [3, 37, 69, 71, 21]
2
+
3
+#---Normally---
4
+# for i in range(len(l)):
5
+# print(f"Item at index {i} is {l[i]}")
6
+#-------OR----
7
+# index = 0
8
+# for i in l:
9
+# print(f"Item at index {index} is {i}")
10
+# index += 1
11
12
+#----Using enumerate:
13
14
+for index, i in enumerate(l):
15
+ print(f"Item at index {index} is {i}")
codes_in_Aug2025/Advance python/exception.py
@@ -0,0 +1,5 @@
+try:
+ x = int(input("Enter a number: "))
+ print(f"You entered: {x}")
+except:
+ print(f"Please enter a valid integer.")
0 commit comments