Python

Ace your homework & exams now with Quizwiz!

commands in numpy to create an array

np.array()

Dictionary

Dictionaries are used to store data values in key:value pairs. A dictionary is a collection which is ordered*, changeable and do not allow duplicates. Dictionary items are presented in key:value pairs, and can be referred to by using the key name.

List

Lists are used to store multiple items in a single variable. Lists are created using square brackets [] List items are ordered, changeable, and allow duplicate values (O,C,A) List items are indexed, the first item has index [0], the second item has index [1] etc.

is a Python library is used for working with arrays. is short for "Numerical Python".

NumPy

Sets

Sets are used to store multiple items in a single variable. A set is a collection which is unordered, unchangeable*, and unindexed. Set items are unordered, unchangeable, and do not allow duplicate values.

means taking elements from one given index to another given index [start:end:step]

Slicing arrays arr = np.array([1, 2, 3, 4, 5, 6, 7]) print(arr[-3:-1])

Tuples

Tuples are used to store multiple items in a single variable. Tuple is one of 4 built-in data types in Python used to store collections of data, the other 3 are List, Set, and Dictionary, all with different qualities and usage. A tuple is a collection which is ordered and unchangeable. Tuples are written with round brackets. Tuple items are ordered, unchangeable, and allow duplicate values. Tuple items are indexed, the first item has index [0], the second item has index [1] etc.

can be a class or instance _______________________ which defines as the variables .

attributes

property that returns the data type of the array

dtype

This method allows you to format selected parts of a string.

format()

attribute that returns an integer that tells us how many dimensions the array have

ndim


Related study sets

Quiz 5 Review: Part 1 Momentum and Collision

View Set

Tradeoffs Associated with digital data 1-10

View Set

CS 332/ 532 Systems Programming Lecture Two Introduction

View Set

LS1 Week 8 Chapter 55 Management of Pt With Urinary Disorders

View Set

The Nature, Components, Types, and Physiology of Pain

View Set