Open krp opened 1 year ago
Problem: https://www.codewars.com/kata/5287e858c6b5a9678200083c/train/python
issues: sum of power of values was not compiling through the array. Code error: using =+ instead of '+='
SOLVED
Problem: https://www.codewars.com/kata/5390bac347d09b7da40006f6/train/python
Taking a break to prep for first day Internship.
https://www.codewars.com/kata/55fd2d567d94ac3bc9000064/train/python
def row_sum_odd_numbers(n):
return n ** 3
(n) is the input value, (**) is the power, like x^ of (3) which outputs the sum.
SOLVED
https://www.codewars.com/kata/57a0885cbb9944e24c00008e/train/python
Remove Exclamation Marks
def remove_exclamation_marks(s):
return s.replace("!","")
(return) is needed to return the solution, if not then it won't make the changes needed to solve it. (s.replace("!","") s.replace will replace ("!" into "") which effectively removes !
This effectively could replace/change any word into another word.
SOLVED
https://www.codewars.com/kata/50654ddff44f800200000004/train/python
This brings up the importance of a return function. Hint Hint
SOLVED
https://www.codewars.com/kata/55685cd7ad70877c23000102/train/python
Return Negative:
Original Code:
def make_negative( number ): if number < 0: return number return number * -1
Simple to understand. If the number is anything lower than 0, it just returns the number. The last code returns a number and multiplies a negative one which just turns the original number into a negative number.
Once finished, I discovered in the solutions that there is another easier way to solve it which includes (abs). No idea what it was about so I investigated (abs)olute) value and it refers to how far away the number is from zero, regardless of whether the number is positive or negative.
abs(value) will forever return a positive number but what about -abs(value)?
SOLVED
https://www.codewars.com/