Chapter 4 Flashcards
Data is….
Information
Character
A single character
String
A list of characters
A strongly typed language is….
You must STATE THE VARIABLE TYPE when creating a variable
What is a weakly typed programming language.
The language guesses what data type should be used
Counts how many characters eg. ***(orange) -> 6
Len(string)
‘orange’.**() -> Orange
String.capitilize()
‘BanAna’.*****() - banana
String.lower()
‘Banana’.*****() - BANANA
String.upper()
Moves to the right eg. ‘Dog’.*****(50) - Dog
String.rjust(number)
‘Dog’.****(‘o’,’i’) - dig
String.replace(oldvalue, newvalue))
Splits into list eg. ‘Myname’.*****(‘y’) - [‘my,’name’]
String.split(separator)
Remove characters from the beginning and the end of the string.
String.strip(chatacters)
Converts a list into string where each item in the list is joined by that string. Eg.
‘+’.**([‘Bill’,’Barney’,Ben’)] ——> Bill+Barney+Ben
String.join(list)
Locates the index position of the first character of the substring. Eg.
‘The missing word’.**(‘miss’) —> 4
String.find(substrings)