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

Karteikarten

Python basic programming technique

Jacob Slater Computing Year 8 Englisch 15 Karten

Karten in diesem Stapel (15)

  1. 1Define a constant and define a variable?constant:
    A constant is a memory location used to store a value that cannot be changed whilst the program is running
    variable:
    A variable is a memory location used to store a value that can be changed whilst the program is running
  2. 2name and give an example of all data types used in programming?string:"Hello"
    integer: "3"
    floating/real number: "3.5"
    boolean: "true"
    character: "K"
  3. 3What is casting?casting is used to convert one data type into another. For example:
    int(string variable) this would convert a string into an integer.
  4. 4state common arithmatic operators?+ addition adds two or more values together
    - subtraction takes the second value from the first value
    *multiplication multiplies two or more values together
    /real division divides first value by second value
    //integer division used to find the quotient(integer number before the decimal point) after division
    %remainder used to find remainder(modulus) after division
    **exponential raises the value to the power of the exponential
  5. 5what is the difference between modulus and quotient division?Modulus division finds the remainder of the sum and quotient division finds the whole number or integer of the sum.
  6. 6What is a sequence and give an example?A sequence is a pre-determined order carried out into the next one. No action can be skipped in the sequence.Example:
    cat = input("Enter name of your cat")
    name = input("Enter you name")
    print("Your name is",name,"and your cats name is",cat,)
  7. 7What is a selection and give an example?Selection is an algorithm to choose between two or more options. We use the if the else structure make decisions about which path to follow. Example:
    Passcode = input("Enter passcode")
    If passcode =="Go":
    print("Allow unrestricted access
    Else:
    print("Deny all access")
  8. 8what is a iteration and give an example?Iteration is the process of repeating a set of instructions a fixed number of times or until a condition is met. The two types of loops are:
    count-controlled-for loops
    condition controlled-while loops
    Example:
    for x in range(1,6)
    while fruit =="bannanas":
  9. 9define the term string concatenation?String concatenation is when you join strings together using + sign example:
    string1 = input("Enter favourite colour")
    string2 = "cat"
    newstring = string1+""+string2
    print(newstring)
  10. 10What does x.upper() do in python?x is now all upper case letters
  11. 11what does x.lower() do in python?x is now all lower case letters
  12. 12what does len(x) do in python?Calculates the number of characters in a string
  13. 13what does x[index] do in python?extracts that character from the string starts at 0 example:
    x = "Hello"
    print(x[2])
    it would print l
  14. 14what does x[a:b] do in python?extracts string starting at position a and finish at position b. Example:
    x = "hello"
    print(x[0:4]
    it would print hell
  15. 15what does x.substring(a,b) do in javascript?extracts a string starting at position a with a length of b. Example:
    x = "hello"
    print(x.substring(0,2))
    this would print he

Informationen

Beschreibung
gcse programming techniques
Erstellt von
Jacob Slater
Aufrufe
10
Bewertung

Feedback

Worum geht es?

Wie gefällt dir das neue Design?

Dein Eindruck