Merhawi travels around Eritrea for two weeks. Start with an empty set visited. Use a for loop and add() to add each city from week1. Use update() to add all cities from the tuple week2. Finally add “Adi Keyh”. Print …
The set fruits holds two fruits. Add “papaya” with add(). Add all fruits from the list delivery with update(). Print the number of fruits, then the sorted fruits. Expected output: 5 [‘banana’, ‘guava’, ‘mango’, ‘orange’, ‘papaya’]
A cafe in Massawa has the drinks in the set available. A group orders the drinks in the list order. Loop through order (the list, so the order is predictable). For each drink print drink: yes if it is available, …
The set members holds the members of the football club. Create is_abel — True or False, depending on whether “Abel” is in members. Use in. Create is_ruta in the same way for “Ruta”. Print both variables. Expected output: True False
A bus company in Asmara wants to know if any ticket number was sold twice. Create unique_count — the number of different ticket numbers. Create has_duplicates — True if the list contains any repeated number. Compare unique_count with the length …
Some students registered for the computer club more than once. The list registrations is given. Create a set called unique_students from the list. Print the number of unique students. Print the names in alphabetical order with sorted(). Expected output: 4 …
The tuple temperatures holds the daily temperatures in Massawa for one week (day 1 to day 7). Create: highest and lowest — the highest and lowest temperatures average — the average, rounded to 1 decimal place hottest_day — the day …
The class voted for a class leader. Every vote is in the tuple votes. Create selam_votes — how many times “Selam” appears (use count()). Create first_abel — the index of the first vote for “Abel” (use index()). Print both variables. …
Build a tuple song in one line that contains, in this order: the item “start”, the rhythm tuple repeated 3 times, the items of the list extra (convert it to a tuple), the item “end”. Print song and then its …
Two study groups are stored in tuples. Create class_list by joining group_a and group_b (in that order) with +. Print class_list and then its length. Expected output: (‘Selam’, ‘Abel’, ‘Merhawi’, ‘Ruta’) 4
