Save
comp
Save
Share
Learn
Content
Leaderboard
Share
Learn
Created by
Amyra
Visit profile
Cards (28)
What are the four common data types in Python?
Integer
,
float
, boolean,
string
View source
What is the difference between an integer and a float in Python?
Integers
are
whole
numbers
;
floats
are
decimals
View source
What does the boolean data type store?
True
or
false
values only
View source
What is a string in Python?
A
combination
of letters, digits, symbols, and spaces
View source
What happens if you store a digit as a string in Python?
You cannot perform
mathematical
operations on it
View source
What is the purpose of the Len function in Python?
To find the
length
of a
string
Counts characters, including spaces and punctuation
View source
How do you count the number of characters in a string variable named phrase?
Use the
Len function
on phrase
View source
How many characters are in the string "hi there"?
Nine
characters
View source
Why does Python count nine characters in "hi there"?
Seven
letters, one space, one
exclamation
mark
View source
What does the index position of a string start from in Python?
Index position starts from
zero
View source
What character is at index position 0 in the string "learning Python"?
Uppercase
L
View source
How do you access the character at index position 2 in a string?
Use
square brackets
with the index number
View source
What will happen if you access an index position that doesn't exist in a string?
The program will
crash
with an
error
View source
What does the find method do in Python?
Finds
the
index
position of a character
View source
What will the find method return if the character is not found in a string?
Minus one
View source
What is a substring?
A section
of
a
string
View source
What does concatenation mean in Python?
Linking
strings
together
View source
How do you extract a substring from a string in Python?
Use
square brackets
with two
integers
View source
How do you concatenate two strings in Python?
Use the
plus sign
View source
What happens if you concatenate two strings without spaces?
No
spaces
will appear in the
new string
View source
What is the ASCII character set?
A character set with unique
character codes
View source
How do you find the character code of a character in Python?
Use the
ord function
View source
What does the chr function do in Python?
Returns the
character
for a given code
View source
Why is it important to change data types in Python?
To perform
mathematical
operations correctly
View source
What does the input function do in Python?
Stores user input as a
string
View source
What happens when you try to use the Len function on an integer?
The program will crash with an
error
View source
How can you prevent a program from crashing when using Len on an integer?
Convert the integer to a
string
first
View source
What are the steps to change a string to an integer or float in Python?
Use the int
function
for integers
Use the float function for floats
Ensure the string represents a valid number
View source
See similar decks
8.4 Examination of "Como la vida misma" by Rosa Montero
AP Spanish Literature and Culture > Unit 8: Escritores contemporáneos de Estados Unidos y España
48 cards
comp
58 cards
comp
112 cards
comp
57 cards
comp
7 cards
Comp
7 cards
computer science
304 cards
COMP
1 card
comp
27 cards
comp
55 cards
comp 2
68 cards
COMP
201 cards
Comp 1
130 cards
Comp 1.2
62 cards
Comp p2
128 cards
Comp p2
151 cards
comp paper2
8 cards
Comp terms
15 cards
Comp 2
106 cards
comp 1
66 cards
Cpu Comp
24 cards