Basic Python - Strings

Rebecca Noel
Flashcards by Rebecca Noel, updated more than 1 year ago
Rebecca Noel
Created by Rebecca Noel about 3 years ago
31
1

Description

String concepts/vocab with Python
Tags

Resource summary

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.
Show full summary Hide full summary

Similar

HTTPS explained with Carrier Pigeons
Shannon Anderson-Rush
Useful String Methods
Shannon Anderson-Rush
Historical Development of Computer Languages
Shannon Anderson-Rush
Code Challenge Flow Chart
Charlotte Hilton
Flvs foundations of programming dba 2
mariaha vassar
Python Quiz
karljmurphy
Think Python
tsilvo2001
What is Python?
Daniel Ingram
Python
54671
Computer Science
Luke Broadley