October 22, 2024
Chicago 12, Melborne City, USA
python

Output is different than Stdout in Python


I’m new to programming and I’m trying Leetcode. The question asks to store the answer inside nums1. When I print nums1, the stdout shows the correct answer but the output is not the same?

enter image description here

class Solution(object):
    def merge(self, nums1, m, nums2, n):
        """
        :type nums1: List[int]
        :type m: int
        :type nums2: List[int]
        :type n: int
        :rtype: None Do not return anything, modify nums1 in-place instead.
        """

        for x in range(n):
            nums1.remove(0)

        nums1 = nums1 + nums2
        nums1.sort()
        print(nums1)

This is what it shows:

enter image description here



You need to sign in to view this answers

Leave feedback about this

  • Quality
  • Price
  • Service

PROS

+
Add Field

CONS

+
Add Field
Choose Image
Choose Video