Unit4python 1 1
Unit4python 1 1
STRING OPERATIONS
SLICING
REPETITION OF STRING
UNDERSTANDING STRING IMMUTABLITY
BUILT-IN STRING METHODS
CONCATENATION OF STRINGS
ESCAPE CHARACTER
REPR()
The repr() function returns a printable representation of the given object.
numbers = [1, 2, 3, 4, 5]
# Output: [1, 2, 3, 4, 5]
repr() Parameters
The repr() function takes a single parameter:
obj - the object whose printable representation has to be returned
repr(obj)
var = 'foo'
print(repr(var))
MODULES
INTRODUCTION TO LISTS
a = [1, 2, 3, 4, 5]
a[0:3] = [100, 100, 100] Changing multiple elements
print(a) # Output: [100, 100, 100, 4, 5]
a = [1, 2, 3, 4, 5]
Certain elements from a list can also be
a[0:3] = [ ]
removed by assigning an empty list to them
print(a) # Output: [4, 5]