I am learning Python and have a question about the print command.
Why in the following case the code with print command works in one line:
text = "The vegetables are in the fridge."
print(text.replace("vegetables", "fruits"))
but here when I write like this, I get no result ?
numbers = [12, 34, 23, 88, 1, 65]
fruits = ["apple", "pear", "orange", "grapes", "mango"]
print(fruits.extend(numbers))
Correct way is the following:
numbers = [12, 34, 23, 88, 1, 65]
fruits = ["apple", "pear", "orange", "grapes", "mango"]
fruits.extend(numbers)
print(fruits)
I mean, if the logic is the following that at first one function works and then the second, then why in the first one it just works?
I hope I could explain it.
Thanks beforehand,
Lilith