GoConqr hat ein neues Design! Sag uns, wie es dir gefällt.

Folien

Ohne Titel

Harriet Leplar Englisch 5 Folien

Folien in diesem Satz (5)

  1. Data types in Python.

    • My definition
    • String: A line of text. This is represented in normal brackets and contains green speech marks. This can be printed.
    • Integer: A whole number in Python. This is represented as int(x) in Python and can be used to do a range of things.
    • Float: A decimal number. Represented as float in Python. Floats must be stated in code if decimals are involved.
    • Google's definition
    • String: In computer programming, a string is traditionally a sequence of characters, either as a literal constant or as some kind of variable.
    • Integer: A number which is not a fraction; a whole number.
    • Float: There is no proper definition.
  2. Types of lists.

    • Lists - Written in [x]. These can be ordered and changed.
    • Tuples - Written in (x). These can be ordered but not changeable.
    • Dictionary - Written in {x}. These are not ordered and not indexed.
    • Example of a list: mylist = ["strawberries", "banana", "raspberries"}
    • Example of a tuple: mytuple = ("Stuart" , "Amy" , "Penny" , "Bernadette")
    • Example of a set: mydictionary = {"
    • "Girls name" : "Harriet"
    • "Boys name" : "Taylor"
    • "Mum's name" : "Deborah"
    • "Brother's name" :"Sam"
    • :}
  3. Dictionaries: Explained.

    • mydictionary = {"
    • "Girls name" : "Harriet" #This allows us to sort of make variables.
    • "Boys name" : "Taylor" #The colons are in place of equals signs.
    • "Mum's name" : "Deborah" #The variable Mum's name would equal Deborah
    • "Brother's name" :"Sam" #We can also use premade variables in our code too.
    • :}
  4. Printing things from list: Key info

    • The first string in your list is the number 0 in the list, not 1.
    • Printing the whole list can be done using a for loop: for x in range (list name) print(x)
    • To print the length of the list, use print(len(listname))
    • To add on to the end of a list, we use listname.append(x)
    • To add to a specific area of a list, we use listname.insert(position number , "x")
    • To remove a specific string from a list we use listname.remove(x)
    • For the remove command, if there is two of the same string in the list, the code will only remove the identical string that appears first in the list.
    • To remove the last string from a list we use listname.pop(.)
  5. Printing from a tuple: Key info

    • Many of the commands are the same as on the previous slide.
    • We can retrieve certain things from a tuple, using the get(x) command.

Informationen

Beschreibung
Folienset am Ohne Titel, erstellt von Harriet Leplar am 21/05/2019.
Erstellt von
Harriet Leplar
Aufrufe
2
Bewertung

Feedback

Worum geht es?

Wie gefällt dir das neue Design?

Dein Eindruck