by Suf | Mar 18, 2022 | Programming, Python, Tips
In Python, a set is an unordered collection of unique elements. The append() method belongs to the List data type. If you try to call the append() method on a set to add elements to the set, you will raise the AttributeError: ‘set’ object has no attribute...
by Suf | Mar 18, 2022 | Programming, Python, Tips
The built-in raw_input() function in Python 2 does not exist in Python 3. In Python 3, we can use the function input() to collect input from the user of a program If you try to use raw_input() in a Python 3 program, you will raise the NameError: name...
by Suf | Mar 18, 2022 | Programming, Python, Tips
The built-in xrange() method in Python 2 does not exist in Python 3. In Python 3, we can use the function range() to produce a range of numbers. If you try to use xrange() in a Python 3 program, you will raise the NameError: name ‘xrange’ is not defined....
by Suf | Mar 17, 2022 | Programming, Python, Tips
In Python, strings are immutable arrays of bytes representing Unicode characters. The pop() method belongs to the List data type and removes the element at the specified position. If you try to call pop() on a string, you will raise the AttributeError:...
by Suf | Mar 17, 2022 | Programming, Python, Tips
In Python, you cannot access values inside a set using indexing syntax. A set is an unordered collection of unique elements. Because a set is unordered, they do not record element position or insertion order. Therefore sets do not support indexing, slicing or other...