04 Lec4 List Numpy

[Pages:71]MSML 605

List Comprehension

List Comprehension

General Syntax

[ ]

3

Squaring numbers

Create a list of squares of numbers from 1 to 5

4

Squaring numbers

Create a list of squares of numbers from 1 to 5

5

Squaring numbers

Even numbers Odd numbers

6

Using if-else conditionals

Make the values between 5 and 10 negative (both included)

7

Create 2D list

8

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download