Chapter 2 - Strings and numbers Flashcards

1
Q

How to keep the console window open?

A

input (“\nPress Enter to exit: “)

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

Examples of string methods?

A

astring.upper() = return astring all in uppercase

astring.index(item) = returns the index of first occurrence of item in astring, or an error if not found

astring.find (item)= returns the index of the first occurrence of item in astring or -1 if not found

astring.replace(old,new) replaces all occurrences of old substring with new in astring,

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

What are some conversion functions?

A

float(x) = converts a string to a floating point value
int(x) = converts a string to an integer
str(x) = converts a number x to a string value

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