CMN 152V CORE MAIN QUESTIONS AND
ANSWERS SURE A+
✔✔how do you find string length - ✔✔len ( )
to print do print ( len ( ) )
✔✔what do you do if a string has quotes in it - ✔✔do ''' '''
✔✔looking In things - ✔✔in
✔✔print ( 'H' in 'Hello') - ✔✔true
✔✔format() uses the same funny dot (.) notation. If you have a string with a pair of curly
brackets ({}) and call format, format will replace the curly brackets with whatever is in
the parentheses. The Google-able jargon for this is really bad: "string interpolation" -
✔✔so it would say whatever variiable is in it
ex: name = 'deb'
print( 'Hello {}' .format(name) )
✔✔print( 'Hello' + ' ' + 'World' )
print( 'comma ' * 3 + 'chameleon') - ✔✔Hello World
comma comma comma chameleon
✔✔how to you test if something is equal - ✔✔==
✔✔how do you test if something is unequal - ✔✔!=
✔✔how do you make an ordered kind of collection - ✔✔a list with 2 brackets [ ]
✔✔how to retrive something from a list - ✔✔print ( highways[1])
ANSWERS SURE A+
✔✔how do you find string length - ✔✔len ( )
to print do print ( len ( ) )
✔✔what do you do if a string has quotes in it - ✔✔do ''' '''
✔✔looking In things - ✔✔in
✔✔print ( 'H' in 'Hello') - ✔✔true
✔✔format() uses the same funny dot (.) notation. If you have a string with a pair of curly
brackets ({}) and call format, format will replace the curly brackets with whatever is in
the parentheses. The Google-able jargon for this is really bad: "string interpolation" -
✔✔so it would say whatever variiable is in it
ex: name = 'deb'
print( 'Hello {}' .format(name) )
✔✔print( 'Hello' + ' ' + 'World' )
print( 'comma ' * 3 + 'chameleon') - ✔✔Hello World
comma comma comma chameleon
✔✔how to you test if something is equal - ✔✔==
✔✔how do you test if something is unequal - ✔✔!=
✔✔how do you make an ordered kind of collection - ✔✔a list with 2 brackets [ ]
✔✔how to retrive something from a list - ✔✔print ( highways[1])