⊗pyPmSlWS 83 of 208 menu

The whole slice in Python

To get the entire slice, you can use the [:] operator:

txt = 'abcde' res = txt[:] print(res) # 'abcde'

Such slices may be needed to copy the original object. Let's copy our string using a slice:

txt1 = 'abcde' txt2 = txt1[:] print(txt2) # 'abcde'

Given a list:

lst = [1, 2, 3]

Copy it.

Given a number:

num = 4567

Write the code to get the following result:

'4567'
byenru