Write a python function that takes a list as an input and converts all numbers to positive numbers and returns the new list


Topic: Write a python function that takes a list as an input and converts all numbers to positive numbers and returns the new list

Solution

def make_all_positive(nums):
   return [num if num > 0 else -num for num in nums]



List all Python Programs