Lessons 1 & 2 Flashcards

1
Q

What is a program?

A

a list of instructions for manipulating numbers or other symbols

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is a computer?

A

a device that can follow the instructions in a program and carry out the manipulations

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the assignment operator in python?

A

=

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Define assignment operator

A

functions to assign a specific value to a variable

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the syntax for exponentiation?

A

**

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Define variable

A

can be thought of as a label for a container than refers to some kind of data or other info stored in a computers memory

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are the containers that refer to some kind of data/info in a computers memory?

A

objects

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

math defines a _____ for the functions in the math module

A

namespace

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

how do you use ln in python?

A

import math
a = math.log(10)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is the class of values that are strings of text characters called?

A

strings

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How do you catenate two strings?

A

by using the * operator

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How do you determine what data type a variable is?

A

type(variable_name)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is an integer?

A

A number without a decimal

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is a float?

A

A floating point number has a decimal

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What does a kernel do?

A

keeps track of variables and their assigned values and other info that defines the state of the notebook at any point

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

String function

A

converts a numeric value (integer or float) to a string; str(5)

17
Q

Integer function

A

converts string to integer; int()

18
Q

Float function

A

converts strings representing numbers to floating point numbers; float(‘string’)

19
Q

What element of a string would strng[0] return? strng[1]?

A

first element; second element

20
Q

Extracting a subset of a string (or other multi-element object) is referred to as_____ and the result is called a _____

A

slicing; slice

21
Q

In a slice, the first number is the index of the _____ element in the substring; the second number in the brackets is _______

A

first; one more than. the index of the last element in the substring

22
Q

The last element in a string is identified by ____

A

-1

23
Q

negative step parameter

A

the slice will be returned in the reverse order

24
Q

The second parameter in a slice specifies

A

the element following the last element to be returned using the original numbering

25
Q

upper method

A

converts lowercase characters to uppercase; my_string.upper()

26
Q

find method

A

a string method that requires an argument; the argument is a search string and the returned value is the first location in the string object at which the search string is found

27
Q

find method using more than one argument

A

can take up to two optional integer arguments, following the string argument, to specify the region of the string to search

the second argument specifies the index of the position immediately following the the region to search

the indexes are separated by commas

28
Q

count method

A

requires a single string argument and can accept two optional integer arguments to specify to the scope of the search

29
Q

replace method

A

requires two input string arguments

searches the string to which it is applied for occurrences of the first argument and returns a new string with all the occurrences replaced with the second string argument

my_string.replace(‘Fred’, ‘Joe’)

30
Q

len function

A

not specific to strings.

a function that returns an integer that represents the number of characters in a string

len(my_string)