• + 0 comments

    def sumofodd(n): a = 0 # Initialize the accumulator for i in range(1, n+1): # Loop through numbers from 1 to n if i % 2 != 0: # Check if the number is odd a += i # Add the odd number to a return a

    b = sumofodd(5) print(b)