Oct-19-2023, 07:05 PM
(This post was last modified: Oct-19-2023, 07:05 PM by deanhystad.)
Great example here:
https://www.dataquest.io/blog/jupyter-no...-tutorial/
Which says:
https://www.dataquest.io/blog/jupyter-no...-tutorial/
Which says:
Quote:In general, the output of a cell comes from any text data specifically printed during the cell's execution, as well as the value of the last line in the cell, be it a lone variable, a function call, or something else.If you ran this cell:
list1 = ["cat", "dog", "cat", "dog"] print(list1.index("cat")) print(list1.count("dog")) f"It is raining {list1[0]}s and {list[1]}s"The output would be
Output:cat
dog
It is raining cats and dogs
The python interactive interpreter does something similar, but it automaticlly prints output at the end of each line, not each cell.Output:>>> print("spam")
spam
>>> print(["spam"] * 4)
['spam', 'spam', 'spam', 'spam']
>>> ", ".join(["spam"] * 4)
'spam, spam, spam, spam'
>>>