The variable message is given. Create three variables: length — the number of characters in message (use len()) has_port — True if the word “port” is in message (use in) no_keren — True if “Keren” is not in message (use …
Write two functions that use the global variable city = “Asmara”: trip() creates a local variable city = “Keren” and prints Inside: Keren. It must not change the global city. move() uses the global keyword to change the global city …
The museum in Massawa counts its visitors. The function add_visitor() should add 1 to the global variable visitors, but it is not finished. Complete the function using the global keyword. The program calls it three times and then prints the …
A bus goes from Asmara to Keren and then to Massawa. Using the variables a, b and c: Create route by joining the three cities with + and ” – ” between them. Print it. Print the three cities with …
Use the given variables to print these three lines: With commas: Selam lives in Asmara With + and str(): Selam is 16 years old With sep=”/”: 29/11/2026 (use the variables day, month and year) Do not change the variables. Expected …
Selam and Abel want to change shifts. Swap morning and evening in one line, without a third variable. Unpack the list marks into three variables: low, middle and high. Create total = low + middle + high. Print morning and …
Write two lines of assignment: In one line, create name, age and city with the values “Merhawi”, 15 and “Massawa”. In one line, set wins, draws and losses all to 0. The print() lines are already written. Expected output: Merhawi …
Selam has 200 Nakfa in her wallet. Create balance = 200 and print it. She buys bread for 25 Nakfa. Reassign balance using its old value (balance = balance – 25) and print it. Her brother Merhawi gives her 50 …
This program does not run because all three variable names break a naming rule. Press Run to see the error. Rename the variables to first_name, home_city and grade, and update the print() lines to match. Keep the values the same. …
A student gets a scholarship if their average is at least 85 and they missed fewer than 5 days. Create good_marks and good_attendance using comparisons. Create eligible that is True only when both are true (use and). Print the three …
