Flashcards
Basic Python - Strings
Cards in this deck (14)
- 1When do we use double quotes with strings?1. So we can properly print a string that includes an apostrophe.
2. So we can include the single quotes when we print the string. - 2When do we use the print function?When we are printing out several sequences.
- 3What does the len() function do?It checks the length of a string.
- 4How do you assign a string to a variable?variable = 'string'
- 5What symbols do we use to call an index of a string?brackets []
- 6What number does indexing begin with?0
- 7If s = 'Hello World', then what would s[:3] print?'Hel'
- 8If s = 'Hello World', then what would s[:-1] print?'Hello Worl'
- 9What symbols can we use to specify the frequency to grab elements when indexing?::
- 10T/F?: Strings are immutable, meaning the elements within can not be changed or replaced once it is created.True
- 11T/F?: You cannot link or add to (concatenate) a string once created.False
- 12T/F?: You cannot reassign a string once it is created.False
- 13How do we call a method?object.method(parameters)
- 14What is the .format() method used for?The .format() method adds formatted objects to printed string statements.
Information
- Description
- String concepts/vocab with Python
- Created by
- Rebecca Noel
- Views
- 132
- Tags
- Rating