--- # #LSEABL: Focus (Week 10) >[name=dabaq0x] >[time=Sun, Aug 16, 2025 10:19 PM] Week nine started out with us exploring the concept of loops and conditionals. We were asuured that once we grasped the concepts wed be set for other aspects of the course. ## Day 1: Troubleshooting Errors Python runs on specified parameters and if any program violates these stipulations, the system is set up to display an error message to notify the programmer the part of the code that violates the standard. Being that most newbie programmers tend to panic when they see an error, we were made to familiarise ourselves with these errors so as not to panic when we see any. Rather than panic, now that we have the possible errors in memory, we would be better equipped to fix them and move on. :::info Python Errors: 1. Name Error 2. Type Error 3. Index Error 4. Syntax Error 5. Indentation Error 6. Logical Error 7. Attribute Error 8. Value Error 9. Key Error ::: ## Day 2: Slicing & Lists We were given several tasks to perform. :::info Task 1:Numbers ```gherkin= # Given this tuple: numbers = (1, 2, 3, 4, 5) #Concatenate it with another tuple (6, 7, 8). numbers + (6, 7, 8) #Slice the first four elements from the new tuple. print (numbers [0:4]) #Convert the tuple to a list and remove the value 3. numbersList = list(numbers) numbersList.remove (3) #Convert it back to a tuple. numbers = tuple (numbersList) print (numbers) ``` ::: :::info Task 2: Fruits ```gherkin= # Given this list: fruits = ["apple", "banana", "mango", "orange"] #Add "grape" to the end of the list. fruits.append("grape") #Insert "cherry" at index 2. fruits.insert (2, "cherry") #Remove "banana" from the list. fruits.remove("banana") #Replace "orange" with "watermelon". fruits[-2] = "watermelon" #Extend the list with ["pear", "kiwi" fruits.extend(["pear", "kiwi"]) print (fruits) ``` ::: ## Day 3: Conditionals A revision of Conditionals, operators and truth tables aimed to solidify our understanding of the concept of it. We were asked to create a simple password match checker. :::info Below are valid operators in Python: "=" Assignment "==" Equality "!=" Not equal ">" Greater than "<" Less than ">=" Greater than or equal to "<=" Less than or equal to :::success Heirarchy/Precedence of logical operators ! ---> and ---> or ::: ### Task 1: We were asked to write a program to check and display thetemperature or weather condition. :::info Task 1: Temperature Check ```gherkin= #Temperature Check temp = 28 if temp < 15: temprature = "cold" elif 15 > temp < 25: temprature = "warm" else: temprature = "hot" print(temprature) ``` ::: ### Task 2: Then we were asked to write a program to demonstrate three shoppers sharing one cart as well as their shopping activities. :::info Task 2: Shopping ```gherkin= #Shopping cart = {} dan = dre = jibrin = cart #dan picks pringles dan.update({"pringles": 2}) #dre picks a watch dre.update({"watch": 1}) #jibrin picks Hollandia jibrin.update({"Hollandia": 3}) print (cart) cart.clear() print (cart) ``` ::: ## Conclusion This weeks activities really solidified our knowledge of some key aspects of python as a programming language.The probation has really lived up to the close monitoring and tutoring it had been promissed to be surely after these intensive tutoring the students should be less likely to make the flimsy errors they were prone to prior. :::danger > Explore more here: https://github.com/dabaq01 :::