Module 1-1,2,3,4

studied byStudied by 0 people
0.0(0)
learn
LearnA personalized and smart learning plan
exam
Practice TestTake a test on your terms and definitions
spaced repetition
Spaced RepetitionScientifically backed study method
heart puzzle
Matching GameHow quick can you match all your cards?
flashcards
FlashcardsStudy terms and definitions

1 / 11

encourage image

There's no tags or description

Looks like no one added any tags here yet for you.

12 Terms

1

Variable naming rules

  • only contain letters, numbers, and underscores

  • start with a letter or underscore (message_1, _message_1), but not with a number (1_message)

  • spaces are not allowed, use underscores as separator

  • avoid Python keywords and function names as variable names

New cards
2

Built in Python keywords and function names

Avoid using when naming variables

New cards
3

Data types in Python (8)

int, float, str, list, tuple, set, dict, bool

New cards
4

Lowest to highest rank type promotion

  1. Boolean

  2. Integer

  3. Float

  4. Complex

New cards
5

Division always returns a

float

New cards
6

What does the // operator do?

// is a ‘floor’ division — returns an integer

New cards
7

How to tab & create a new line

\t

\n

New cards
8

What are 3 data types that you can concatenate (given the elements you are trying to concatenate are all the same type)

  1. Strings

  2. Lists

  3. Tuples

New cards
9

Slice notation syntax

string[start:end]

  • Begin at start index, does not include end index

New cards
10

Negative indexing

  • -1 is the last item in list/string

New cards
11

Slices with steps syntax

string[start : end : step]

step is what we count the indexes by (2 would be skipping every second index)

New cards
12

When would a runtime error occur?

When the syntax is correct, but an issue may arise due to wrong types/names/indexes/dividing by 0

New cards
robot