Suhani Govil Ai File
Suhani Govil Ai File
5. sum_of_numbers = 0
for i in range(1, 11):
sum_of_numbers += i
print("The sum of the first 10 natural numbers is:",
sum_of_numbers)
7. # List of numbers
num = [23, 10, 15, 90, 68, 45]
#i. Print the length of the list
print("Length of the list:", len(num))
#ii. Print the elements from second to fourth
position using positive indexing
print("Elements from second to fourth position
(positive indexing):", num[1:4])
#iii. Print the elements from position third to fifth
using negative indexing
print("Elements from third to fifth position
(negative indexing):", num[-4:-1])