Why doesn't Python print return values?

后端 未结 4 1750
一个人的身影
一个人的身影 2021-01-22 00:49

I\'m taking a class in Algorithms and Data Structures (Python). In the book there is an example of a \"stack\" with methods that return certain values. In the book, these values

4条回答
  •  执笔经年
    2021-01-22 01:32

    Why should it print if you haven't included a print statement? Try:

    print s.size()
    print s.isEmpty()
    print s.peek()
    

提交回复
热议问题