June 2024
Intermediate to advanced
488 pages
9h 29m
English
Given a person's name and the time of the day (morning, afternoon, evening), craft a function named time_greeting that returns an appropriate greeting.
def time_greeting(name, time_of_day):
# Your code here
# Example:
# time_greeting("Alice", "morning") should return "Good morning, Alice!"
You are given a list of colors. Write a for loop that prints out each color with its respective index.
colors = ["red", "green", "blue", "yellow"]
# Your code here
Design a function named simple_calculator that takes in three parameters: two numbers and an operator (either "+", "-", "*", or "/"). The function should return the result ...
Read now
Unlock full access