Quiz tmrw data science

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

1/18

encourage image

There's no tags or description

Looks like no tags are added yet.

19 Terms

1
New cards

Boolean Expressions can be which two things:

True or false

2
New cards

List of Comparison operators:

<, >, ==, !=, <=, and >=

3
New cards

Arithmetic (+-*/) first OR comparison (><=) first?

Arithmetic

4
New cards

False AND true =

False

5
New cards

False OR true =

True

6
New cards

Why should u be careful when using == with Floats?

tiny inaccuracies with the decimals build up and can eventually lead to significantly incorrect results.

7
New cards

Python program definition

A Python program is a sequence of Python statements

8
New cards

What are Python programs executed by?

Executed using an integrated development environment (IDE) or “from the command line”

9
New cards

how to use the if statement:

If (condition here):
(whatever code should happen if the condition is true)

10
New cards

how to use if else statement

If (condition):
(whatever code)
Else:
(anything apart from the if being true will be this)


11
New cards

What is critical for If and if-else statements to work?

Indentation

12
New cards

ow If, elif, else statements work

If (condition):
whatever it is
elif (condition 2):

else:

13
New cards

how does a for loop work:

for (Variable name) in (sequence of some sort):
whatever code block:


Example:

for number in range(5):

print(number)

14
New cards

how to write a for loop on the same line:

for number in range(5):

print(number, end = ' ')

Result: 0 1 2 3 4

15
New cards

how does the range function work:

he range function generates a sequence of integers in a for loop

16
New cards

Different types of range functions

range(n) generates the sequence 0, ..., n-1

• range(i, n)generates the sequence i, i+1, i+2, …, n-1

• range(i, n, c)generates the sequence i, i+c, i+2c, i+3c, …, n-1

17
New cards

for loop – string example:

For example:

word = "apple"

for letter in word:

print(letter)

18
New cards

for loop – tuple example

days = ('Mon','Tue','Wed','Thu','Fri','Sat','Sun')

for day in days:

print(day)

19
New cards

How to append a list:

oneTwoThree = [1, 2, 3]

for i in oneTwoThree:

oneTwoThree.append(i + 3)

print('i = ',i)

print('oneTwoThree = ', oneTwoThree)