Two strings are given. Create: clean — raw with the spaces removed from both ends and all letters in capitals (“KEREN”) new_message — message with “Asmara” replaced by “Keren” Print clean, then new_message. Expected output: KEREN I love Keren
Given date = “2026-11-29” and word = “Nakfa”, create: year — “2026”, using a slice month — “11”, using a slice day — “29”, using a slice with a negative index backwards — word reversed, using a step of -1 …
Given city = “Massawa”, create three variables using indexes and slicing: first — the first character last — the last character (use a negative index) first_three — the first three characters Print them in that order. Expected output: M a …
Create a variable address that holds this text over three lines, using a triple-quoted string. Start the text directly after the opening “”” so that there is no empty first line. Selam Tesfay Harnet Avenue Asmara Then create: first_letter — …
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 …
