¡GoConqr estrena diseño! Cuéntanos qué te parece.

Mapa mental

Revision: commands and strings

Harriet Leplar Inglés

Contenido del mapa

Revision: commands and strings

  1. Strings

    • Writing as str in python.
    • A contiguous collection of characters surrounded by single or double speech marks.
    • Comes up as green speech marks in python.
    • To count a certain number of strings, we always start from zero.
    • h = "cheesecake" print(h[0])
      • This will print the first letter of the variable h which would be "c"
    • h = "cheesecake" print(h[0:5])
      • This allows us to print multiple letters of the varibale h
    • strip( ) command
      • If we have a string with spaces either side of the speech marks, we can remove these using the strip command.
      • This can be also used to take away certain characters in a string. (Note, this can only be done when there are no spaces between the string and the speech marks.)
  2. Upper ( ) and lower ( ) command

    • print(h.upper()) print(h.lower())
      • Upper prints the variable h in capitals.
      • Lower prints the variable h in normal lettering.
  3. len ( ) command

    • print(len(h))
    • prints the length of a variable.
  4. Replace( ) command

    • (h.replace('c' , 'h'))
      • This would print hceesecake
  5. split ( ) command

    • print(h.split(","))
      • This would print the variable h which I have now changed to "love cheesecake") This would print {" love "cheesecake"}
  6. For loops

    • for x in banana: print(x)
      • This print banana like this: b a n a n a

Información

Descripción
Mapa Mental sobre Revision: commands and strings, creado por Harriet Leplar el 14/05/2019.
Creado por
Harriet Leplar
Visitas
0
Valoración

Escríbenos

¿Sobre qué es tu mensaje?

¿Qué te parece el nuevo diseño?

¿Te gusta?