Python Lists(cont.) - Web Development and Design | Tutorial for Java, PHP, HTML, Javascript Python Lists(cont.) - Web Development and Design | Tutorial for Java, PHP, HTML, Javascript

Breaking

Post Top Ad

Post Top Ad

Friday, November 30, 2018

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

 

1 comment:

Post Top Ad