Declaring Lists

Description

In Sage, you can create a list of items and assign it to a variable.

Sage Cell

Code

A = [ 2, 3, 8, 11, 31 ]
print(A)

Options

Lists of Strings

Lists can also be composed of string (text) values:

Code

A = [ 'Them Crooked Vultures', 'Desert Sessions', 'Queens of the Stone Age' ]
print(A)

Tags

Primary Tags—Programming: Python

Secondary Tags—Python: Lists

Related Cells

None

Attribute

Permalink:

Author:

Date: 23 Mar 2019 01:11

Submitted by: Zane Corbiere

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License