Program with output

print("Hello!")

Program with input and output

name = input("What's your name? ")
print(f"Hello, {name}!")

Program with a list

fruits = ["apple", "banana", "cherry"]
print(fruits)

Program with a Dictionary

person = {
    "name": "Alice",
    "age": 30,
    "city": "New York"
}
print(person)

Program with iteration

for i in range(5):
    print(i)

Program with a Function to preform mathematical and/or statistical calculations

def mean(numbers):
    return sum(numbers) / len(numbers)
numbers = [1, 2, 3, 4, 5]
average = mean(numbers)
print(f"The mean of the numbers is: {average}")

Program with a Selection/Condition

temperature = 25  # Example temperature
if temperature > 30:
    print("It's a hot day!")
elif temperature < 10:
    print("It's a cold day!")
else:
    print("The temperature is moderate!")

Program with a simple purpose: A calculator

def calculator(a, b, operation):
    if operation == "+":
        return a + b
    elif operation == "-":
        return a - b
    elif operation == "*":
        return a * b
    elif operation == "/":
        if b == 0:
            return "Division by zero is not allowed"
        return a / b
    else:
        return "Invalid operation"
# Example usage
a = float(input("Enter first number: "))
b = float(input("Enter second number: "))
operation = input("Enter operation (+, -, *, /): ")
result = calculator(a, b, operation)
print(f"The result is: {result}")

Program Design and Development

1. Create a Visual Illiustration of a progream, algorithm, or process:

Flowchart

2. Show documentation of a program with a List and Iteration

def sum_even_numbers(numbers):
    """
    Calculates the sum of even numbers in a list.
    Parameters:
    numbers (list): A list of integers.
    Returns:
    int: The sum of even numbers in the list.
    """
    even_sum = 0  # Initialize the sum to zero
    for num in numbers:
        if num % 2 == 0:  # Check if the number is even
            even_sum += num  # Add even number to the sum
    return even_sum
# Example list of numbers
numbers_list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
# Calculate the sum of even numbers in the list
result = sum_even_numbers(numbers_list)
# Display the result
print("List of numbers:", numbers_list)
print("Sum of even numbers:", result)