Arrays for GCSE and A LEVEL Computer Science - WITH practise questions ( PYTHON code in description)

Sdílet
Vložit
  • čas přidán 25. 06. 2024
  • A complete practical tutorial that will give you a solid introduction and understanding of arrays. Lots of practical programming for you to try.
    Please pause the video at each question and use the codes below in you favourite python compiler.
    I tend to use:
    www.programiz.com/python-prog...
    Good luck :)
    ##### PYTHON CODE FOR TASK 1 #####
    Monarch = ["Henry VIII", "Edward VI", "MARY I", "Elizabeth I", "James I", "Charles I", "Charles II", "James II", "William III and Mary II", "Anne", "George I", "George II", "George III", "George IV", "William IV", "Victoria", "", "", "", "", "", "", "", ]
    #Declare Reign : ARRAY [0:21]OF STRING
    Reign = ["1509 - 1547", "1547 - 1553", "1553 - 1558", "1558-1603", "1603 -1625", "1625 - 1649", "1660 - 1685", "1685 - 1688", "1689 - 1702 and 1689 - 1694", "1702 - 1714", "1714 -1727", "1727 - 1760", "1760 - 1820", "1820 - 1830", "1830 - 1837", "1837 - 1901", "", "", "", "", "", "", "", ]
    ##### PYTHON CODE FOR TASK 2 #####
    Monarch = ["Henry VIII", "Edward VI", "MARY I", "Elizabeth I", "James I", "Charles I", "Charles II", "James II", "William III and Mary II", "Anne", "George I", "George II", "George III", "George IV", "William IV", "Victoria", "", "", "", "", "", "", "", ]
    #Declare Reign : ARRAY [0:21]OF STRING
    Reign = ["1509 - 1547", "1547 - 1553", "1553 - 1558", "1558-1603", "1603 -1625", "1625 - 1649", "1660 - 1685", "1685 - 1688", "1689 - 1702 and 1689 - 1694", "1702 - 1714", "1714 -1727", "1727 - 1760", "1760 - 1820", "1820 - 1830", "1830 - 1837", "1837 - 1901", "", "", "", "", "", "", "", ]
    ##### PYTHON CODE FOR TASK 3 #####
    Monarch = ["Henry VIII", "Edward VI", "MARY I", "Elizabeth I", "James I", "Charles I", "Charles II", "James II", "William III and Mary II", "Anne", "George I", "George II", "George III", "George IV", "William IV", "Victoria", "", "", "", "", "", "", "", ]
    #Declare Reign : ARRAY [0:21]OF STRING
    Reign = ["1509 - 1547", "1547 - 1553", "1553 - 1558", "1558-1603", "1603 -1625", "1625 - 1649", "1660 - 1685", "1685 - 1688", "1689 - 1702 and 1689 - 1694", "1702 - 1714", "1714 -1727", "1727 - 1760", "1760 - 1820", "1820 - 1830", "1830 - 1837", "1837 - 1901", "", "", "", "", "", "", "", ]
    ##### PYTHON CODE FOR TASK 4 #####
    PizzaToppings = ["chilli", "1.50", "Ham", "2.00", "Pineapple", "5.00", "cheese", "2.00"]
    TopChoice = input("Enter a topping")
    for i in range( len (PizzaToppings) ):
    if TopChoice == PizzaToppings[i]:
    #now print the cost of the found topping
    print("Found")
    ##### PYTHON CODE FOR TASK 5 #####
    Products = ["0001", "Soap", "1.45", "0002", "Juice", "2.20", "Charles II", "0003", "Bread", "1.50", "0004", "Coffee", "2.80", "0005", "Tea", "2.40", "0006", "Cake", "3.00", "0007", "6 Eggs", "1.70", "0008", "Apples", "3.10", "0009", "Butter", "2.90"]
    ##### PYTHON CODE FOR TASK 6 #####
    Products = ["0001", "Soap", "1.45", "0002", "Juice", "2.20", "Charles II", "0003", "Bread", "1.50", "0004", "Coffee", "2.80", "0005", "Tea", "2.40", "0006", "Cake", "3.00", "0007", "6 Eggs", "1.70", "0008", "Apples", "3.10", "0009", "Butter", "2.90"]
    ##### PYTHON CODE FOR TASK 7 #####
    Products = ["0001", "Soap", "1.45", "0002", "Juice", "2.20", "Charles II", "0003", "Bread", "1.50", "0004", "Coffee", "2.80", "0005", "Tea", "2.40", "0006", "Cake", "3.00", "0007", "6 Eggs", "1.70", "0008", "Apples", "3.10", "0009", "Butter", "2.90"]

Komentáře •