Final Exams: Chapter 1 and 2 Flashcards

1
Q

What is a variable?

A

It store data to a name

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

What is an integer (int)

A

Interpret the users input as a number

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

What is a while loop

A

A while loop continues to run the code until and input changes (ie no)

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

What does == mean

A

Equal to

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

What does != mean

A

Not Equal to

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

What does “from random import randint” mean

A

It tells the program to import the function randint

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

What an Assignment

A

It set a name to a value

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

What is a =

A

Assignment opperator

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

What is a print( )

A

It displays a message screen

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

What is a input( )

A

Gets and returns a users value

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

What is a int( )

A

Converts characters into numbers

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

What is ranint( )

A

produces a random number

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

What is a string

A

A series of characters

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

What is a substring

A

It is a sequence of characters contained with a another string

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

In the statement “print(msg.upper)))” what does the dot mean

A

The dot means “call the method on the specified variable

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

In the statement “print(msg.upper)))” what does upper() mean

A

The upper means is a string method

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

What does text.endswith(“.jpg”) mean

A

Return the value True if the string has the given substring at the end.

18
Q

What does text.upper() mean

A

Return a copy of the string converted to uppercase.

19
Q

What does text.lower(): mean

A

Return a copy of the string converted to lowercase.

20
Q

text.replace(“tomorrow”, “Tuesday”): mean

A

Return a copy of the string with all occurrences of one substring replaced by another.

21
Q

What does “text.strip():” mean

A

Return a copy of the string with the leading and trailing whitespace removed.

22
Q

What does text.find(“python”): mean

A

Return the first index value when the given substring is found.

23
Q

What does text.startswith(“” mean

A

Return a copy of the string with all occurrences of one substring replaced by another.

24
Q

What does the find( ) method mean

A

finds the starting position of a substring

25
What is a float
It converts whole number into a decimal number
26
what does import urllib.request mean
use code stored in the “urllib.request” library.
27
What are strings?
Sequences of individual characters.
28
Individual string characters are referenced by?
Index
29
Index values are offsets that start from?
0 (Zero)
30
Methods provide variables with?
built-in functionality
31
Programming libraries provide a collection of
related pre-built code and functions.
32
Number is a
Data Type
33
String is
Data Type
34
s[4]
access the 5th character of the variable “s", which is a string
35
s[6:12]
Searches from the 7th character of the variable to the 11 variable access a sub-string within the string “s" (up to, but not including)
36
s.find() method for
searching strings
37
s.upper() method for
converting strings to UPPERCASE
38
float() converts strings to
Decimal point numbers known as “floats"
39
What is the +
addition operator
40
What is >
greater than operator
41
urllib.request library for talking
to the web
42
time library for working with
date/time