Hello, I have just fisnished section "Lists and Functions" and I decided to stop to learn next section to apply what I learned. So, I thought personally a problem and attempt to solve my problem by myself but it's difficult to me Please help me
P1: Create a list : a = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]. Print out a list
P2: Create a function to remove even numbers and compute sum odd numbers in the list.
print a def sum_odd_numbers(i): # expect i in int sum_odds = 0 for x in i: if i[x] % 2 == 0: i.remove(i[x]) else: sum_odds += i[x] return sum_odds print sum_odd_numbers(a)
Please correct me ^^ thank in advance. I'm most confused about line 6 in my code