Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

05.1 Sum the odd numbers

📝 Instructions:

  1. Create a function called sum_odds that sums all the odd numbers in the my_list variable.

  2. Return and print the result.

💡 Hints:

  • You will need to declare an auxiliary variable outside the loop to keep adding the values.

  • You have to loop the list.

  • On each loop, you have to ask if the value of the list in that index position is an odd number.

  • If its odd, then add the value to the auxiliary variable.

  • An auxiliary variable is a regular variable, the only difference is a logical difference; an auxiliary variable is like a chosen one, it'll be useful until it completes its purpose (add all the values, make a copy of a value, etc.).