One of the predefined sub-programs in the new language is sumOdd().
It accepts an integer N as input. If N <= 0 it outputs -1, otherwise it outputs the sum of the first N odd numbers.
For example:
sumOdd(4) outputs 16, because 4 is not less than 0, and
1 + 3 + 5 + 7 = 16.
sumOdd(−3) outputs −1, because −3 is less than 0.
(e) Construct, in Python, an algorithm for sumOdd(). [4]
Part 1
Use replit to create your program.
Part 2
Here is a Python program to answer the above question but it is not working correctly.
Find the errors.