DEV Community

CoderEthanLiu
CoderEthanLiu

Posted on • Updated on

Python

command line:
exit()
x=y=z=5

The discard() method removes the specified item from the set. This method is different from the remove() method, because the remove() method will raise an error if the specified item does not exist, and the discard() method will not.

use "while True:" to restart the .py

when you define the function, () is called parameter. when you call the function, () is called argument value, arguement = argument value, no space between =.

strings are immutable, lists are mutable. str.replace(), tuple is an immutable version of list.

A set is a collection which is unordered, unchangeable*, and unindexed.

  • Note: Set items are unchangeable, but you can remove items and add new items.

The == operator compares the value or equality of two objects, whereas the Python is operator checks whether two variables point to the same object in memory. In the vast majority of cases, this means you should use the equality operators == and !=, except when you’re comparing to None.

Top comments (0)