user
Modify the given code to print out the largest number in the list.

nums = [3, 4, 9, 5]

# Iterate over nums
for num in nums:
        # Check if num is even
        if num % 2 == 0:
                # Print out num
                print(num)


assistant
nums = [3, 4, 9, 5]

# Assign largest_num to -infinity
largest_num = -float('inf')

# Iterate over nums
for num in nums:
    # Check if num is larger than largest_num
    if num > largest_num:
        # Assign num to largest_num
        largest_num = num

# Print out largest_num
print(largest_num)