Python Lists(cont.)

Python Lists(cont.)


Introduction

#List comprehensions
square = [x**2 for x in range(1,11)]


#slicing a list
finishers = ['sam', 'bob', 'ada', 'bea']

#copying a list
copy_of_square = square[:]
print(copy_of_square)
print(finishers)


Screenshot 

python list

 

0 comments:

Post a Comment