|
|
Created by Rebecca Noel
about 9 years ago
|
|
| Question | Answer |
| When 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. |
| When do we use the print function? | When we are printing out several sequences. |
| What does the len() function do? | It checks the length of a string. |
| How do you assign a string to a variable? | variable = 'string' |
| What symbols do we use to call an index of a string? | brackets [] |
| What number does indexing begin with? | 0 |
| If s = 'Hello World', then what would s[:3] print? | 'Hel' |
| If s = 'Hello World', then what would s[:-1] print? | 'Hello Worl' |
| What symbols can we use to specify the frequency to grab elements when indexing? | :: |
| T/F?: Strings are immutable, meaning the elements within can not be changed or replaced once it is created. | True |
| T/F?: You cannot link or add to (concatenate) a string once created. | False |
| T/F?: You cannot reassign a string once it is created. | False |
| How do we call a method? | object.method(parameters) |
| What is the .format() method used for? | The .format() method adds formatted objects to printed string statements. |
Want to create your own Flashcards for free with GoConqr? Learn more.