226455/sum-of-odd-numbers-using-while-loop-in-python
I'm new to programming, I was asked to use a while loop to add all odd numbers between 1 and (2*n)-1.
def sum_odd_n(n): while n<2*n: sum = 0 if n%2==1: sum = sum+n return (sum)
I cannot find my mistake. Please help
OR
At least 1 upper-case and 1 lower-case letter
Minimum 8 characters and Maximum 50 characters
Already have an account? Sign in.