--- # #LSEABL: Pythonista (Week 7) >[name=dabaq0x] >[time=Sat, Jul 25, 2025 10:09 PM] The python experience was taken a step further as we kickstarted the seventh week of our journey to being software engineers. ## Day 1: Operands Operators are special tokens that represent computations like addition, multiplication and division. The values the operator works on are called operands. This week, we did a lot more hands on tasks to solidify ourselves in the skills we were trying to gain. :::info Below is a task to simulate a grade display program: ::: ```gherkin= #Grade Display userScore = float(input(f"Please enter your score:\n")) print (f"Is {userScore} greater than or equal to 70?:", userScore >= 70) print (f"Is {userScore} Less than 70?:", userScore < 70) ``` :::info Below is a task to simulate an ATM Display: ::: ```gherkin= #ATM Display pin = 4190 print ("Welcome to Our ATM") userPin = int(input(f"Please enter your PIN:\n>>>")) print ("Is the inputted PIN correct?:", userPin == pin) ``` :::info Below is a task to demonstrate true and false: ::: ```gherkin= num1 = 30 num2 = 50 #F and T print ((num1 < num2) and (num2 > num1)) ``` :::info Below is another task to demonstrate true and false: ::: ```gherkin= num1 = 5 num2 = 10 num3 = 2 num4 = 4 num5 = 7 num6 = 8 num7 = 1 num8 = 0 num9 = 3 print (num1 > num3 and num2 == num2) print (num4 != num4 or num5 < num3 and num7 > num8) print (not num9 == num9) print (not num2 > num9) print (num6 > num9 and num6 != num4) ``` ## Day 2: List We explored lists and how to manipulate them in different ways that serve different purposes. :::info Below is a task we were given to tesk what we had learnt: ::: ```gherkin= #Task accounts = [ ["1001", "Joy", "Savings", 1500], ["1002", "David", "Current", 2000], ["1003", "Ruth", "Savings", 1800] ] #Remove the account of David accounts.remove (accounts[1]) print (accounts) #Extract Ruth and her account type accountRuth = accounts [1] print (accountRuth) name, account = accounts[1][1:3] print (name) print (account) #Extract Joy and her account type accountJoy = accounts [0] print (accountJoy) name, account = accounts[0][1:3] print (name) print (account) ``` ## Day 3: Test Day As expected, the day came with two tests; The first being a timed multiple choice questions and the second was a hands on test. The second test consisted of five tasks, each timed less than five minutes. But the twist for the week was the fact that factored into the time for each task, was a 60 second window under which we were required to push what we'd done to our github repositories. Task 1: We were asked to manipulate the list of items on the menu by first moving an items's position, then taking something off the list, then outputting the item in the middle of the menu and finally arranging the menu in alphabetical order. :::info Note: We had to print the output each time a change was made ::: ```gherkin= #meal plan for the Jos Food and Culture Festival meals = ["Gwote", "Masa", "Tuwon Acha", "Fura da Nono", "Kunu", "Miyan Kuka"] #move "Miyan Taushe" to the position before "Kunu" meals.insert(4, "Miyan Taushe") print (meals) #take masa off the list meals.remove(meals[1]) print (meals) #move "Fura da Nono" to the end of the list meals.remove(meals[2]) meals.append("Fura da Nono") print (meals) #which item is at the center centerIndex = len(meals) //2 centerMeal = meals[centerIndex] print (centerMeal) #arrange the menu in alphabetical order meals.sort() print(meals) ``` Task 2: Then we were given a list of genres for a Community Film Night for kids and asked to modify it according to some stipulations. First was to add a genre, then take out one that had appeared twice, then print out the number of genres and the second to the last genre according to the updated arrangement. ```gherkin= #community Friday Film Night for kids genres = ["Adventure", "Comedy", "Animation", "Fantasy", "Sci-Fi", "Documentary", "Fantasy"] #add drama to the list genres.append("Drama") print (genres) #remove duplicate "Fantasy" genres.remove (genres[6]) print (genres) #how many genres will be shown? totalGenres = len(genres) print (totalGenres) #display second to last genre secondToLastGenre = genres[-2] print (secondToLastGenre) ``` Task 3: We were asked to build a small tracker for our younger sibling's weekly pocket money. First it was to sum the total for the stipulated period then edit and correct an error on the third amount stipulated on the list, display the list in reverse to place the most recent payment first, and finally tooutput the result. ```gherkin= #building a small tracker for your younger sibling's weekly pocket money money = [1000, 1200, 800, 1500, 1100] #calculate the total total = money [0] + money [1] + money [2] + money [3] + money [4] print (total) #A mistake was made in the third week's entry (800). It should have been 1000. Fix it. money[2]=1000 print (money) #Display the list in reverse order to check most recent payments first. print (money[::-1]) ``` Task 4: This task was a simulation for helping a student at the University of Jos register for courses for the semester. We were first to add a course to the list then remove a course, thendisplay the total number of courses and finally print the third course on the list. ```gherkin= #Course registration courses = ["MTH 101", "PHY 101", "CHM 101", "CSC 101", "GST 101"] #add "ENG 101" at the beginning of their course list courses.insert(0, "ENG 101") print (courses) #remove "GST 101" courses.remove(courses[-1]) #add "BIO 101" right after "CHM 101" courses.insert(4, "BIO 101") print (courses) #isplay the total number of courses totalCourses = len(courses) print (totalCourses) #3rd course in the list print (courses[2]) ``` Task 5: For the final task, we were given a list of contacts and required to clean up the list. First by adding a name to the list then taking one off, then updating a contact's name, then adding another name, displaying a specific contact's name and finally printing the updated list in descending alphabetical order. ```gherkin= #cleaning up your phone's contact list friends = ["Aisha", "Daniel", "Esther", "John", "Mary", "Paul", "Ruth"] #add "Kemi" between "John" and "Mary" friends.insert(4, "Kemi") print (friends) #remove "Daniel" friends.remove(friends[1]) print (friends) #Update "Aisha" to "Aisha_M" friends[0] = ("Aisha_M") print (friends) #add "Zainab" at the end of the list friends.append("Zainab") print (friends) #Create a new list with only the first 3 friends from your updated list and display it newFriends = friends[0:3] print (newFriends) #what position is "Paul" in on your final friends list paulPosition = friends.index("Paul") print (f"Paul's position on the contacts list is number:", paulPosition) #arrange your contacts in Descending Alphabetical Order friends.sort(reverse=True) print (f"the contacts list in descending order is:", friends) ``` ## Conclusion This weeks test was a bit more fast paced, but at least we seemed to have gained a bit of speed and resilience when it comes to approaching the tasks. Practice really does pay off. :::danger > Explore more here: https://github.com/dabaq01 :::