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

Mapa mental

Python

Gbubemi Arenyeka Computing Year 9 Inglés

Contenido del mapa

Python

  1. A string is a piece of text put in speech marks

    • money = 15 print ("You have £"+str(money))
      • money=15 is an integer, as there aren't any speech marks so the module won't work, so you put str in front of money in brackets, so the computer thinks it's a string, so it'll work
      • This is casting
        • value = "3" print (value + value) value = int(value) print (value + value)
          • value becomes an integer as putting int( in front of (value) it makes it an integer, and since the value is 3, and since the equation is Value+value it is 3+3 which is 6
    • E.g. print("Hello World")
  2. A float is a decimal number

  3. An integer is a whole number

  4. Lists

    • thislist=["apple","banana","cherry"]
      • apple=0,banana=1,cherry=2
      • print(thislist) meaning when you print it,it will print apple,cherry,banana
      • print(this list[1],will print banana,as banana is 1,print(this list[2]),will print cherry as cherry is 2,etc
        • if you put print(thislist[1]="blackcurrant" then print(thislist) it will print the list but instead of the list being apple,banana,cherry it will print apple,blackcurrant,cherry as you changed the value 1 to blackcurrant instead of banana
      • if you put print(x) after print(thislist) it will print each item one by one
    • putting this list.remove("banana") then print(thislist)will print out the list,but will remove banana from it
    • thislist.append("orange") adds orange to the list
  5. Function

    • def my_function(): creates the function called my function
    • To call a function you do def my_function(): then print("hello from a function) then my_function() for the output to be Hello from a function
    • Parameters
      • To pass info from a function you use this
      • def my_function(fname): then print(fname + " Refsnes") then my_function("Emil") my_function("Tobias") my_function("Linus")
        • this will print Emil Refsnes,Tobias Refsnes and Linus Refsnes
          • It prints this out as in the brackets you put fname then putting( fname + "Refsnes") will make fname Refsnes and putting my_function("Emil") will put the name Emil in front of Refsnes, so they it becomes Emil Refsnes
  6. Concatenation

    • a = "Hello" b = "World" c = a + b print(c)
      • when you print(c),since c is equal to a+b a representing Hello and b representing World it would equal hello world

Información

Descripción
Year 9 Computing Mapa Mental sobre Python, creado por Gbubemi Arenyeka el 01/10/2019.
Visitas
18
Valoración

Escríbenos

¿Sobre qué es tu mensaje?

¿Qué te parece el nuevo diseño?

¿Te gusta?