Python syntax for arrays and strings

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/14

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 7:14 PM on 6/17/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

15 Terms

1
New cards

nums[i]

Accesses the element at index i

2
New cards

nums[-1]

Accesses the last element

3
New cards

nums[a:b]

Gets elements from index a to b - 1

4
New cards

nums[::-1]

Returns nums reversed

5
New cards

nums.append(x)

Adds x to the end of nums

6
New cards

nums.pop()

Removes and returns the last element

7
New cards

nums.sort()

Sorts nums in place ascending

8
New cards

sorted(nums)

Returns a new sorted list

9
New cards

[x for x in nums if x > 0]

Creates a list of positive values

10
New cards

s[i]

Accesses character at index i

11
New cards

s[a:b]

Gets substring from index a to b - 1

12
New cards

s.split()

Splits string by whitespace

13
New cards

"".join(chars)

Joins characters into one string

14
New cards

ord(c) - ord("a")

Maps some lower case letter c to index 0 through 25 by taking advantage of ascii values of lowercase letters

15
New cards

[[0] * cols for _ in range(rows)]

Creates a 2D grid with independent rows