Collaboration Review
What are the benefits of a team?
- Collaboration: Teams bring together diverse perspectives and skills, enhancing problem-solving and creativity.
- Increased Productivity: Team members can divide tasks, reducing individual workload and achieving goals faster.
- Knowledge Sharing: Teams allow for the exchange of expertise and learning opportunities.
- Support and Motivation: Team members can provide emotional support and motivation, boosting morale.
- Better Decision-Making: Diverse opinions lead to well-rounded decisions.
- Risk Mitigation: Multiple minds can identify and address potential issues more effectively. Our team comprises members from various cultural backgrounds, enriching our perspectives and approaches. We have individuals with a wide range of skills, from technical to creative, ensuring comprehensive problem-solving.
Things we will do to facilitate communication amongst group members:
- Regular Meetings: We will hold regular team meetings every class to discuss progress, issues, and updates.
- Communication Tools: We will utilize communication tools like text, snapchat, and slack.
- Open Code Policy: Encouraging open and honest communication and collaboration, team members can refer to each other’s codes for help and collaboration.
- Clear Channels: Establishing clear channels for reporting problems or seeking assistance.
Program Function and Purpose
Program with Output: Print Function Program with Input and Output: Python Quiz Program with a List: Cool kid list Program with a Dictionary:word search Program with Iteration:sort through dictionary data Program with a Function to perform mathematical and/or a statistical calculations: Average Calculator Program with a Selection/Condition: x value test Finish with a Program with Purpose: Pacman
Program Design and Development
The following program calculates the average of numbers in a list using iteration:
# Define a list of numbers
numbers = [10, 20, 30, 40, 50]
# Initialize a variable to store the sum of numbers
total = 0
# Iterate through the list of numbers
for num in numbers:
# Add each number to the total
total += num
# Calculate the average by dividing the total by the number of elements in the list
average = total / len(numbers)
# Print the list of numbers
print("List of Numbers:", numbers)
# Print the sum of numbers
print("Sum of Numbers:", total)
# Print the average
print("Average:", average)
We start by defining a list of numbers called numbers.
We initialize a variable total to store the sum of the numbers, setting it to 0.
We use a for loop to iterate through each element in the numbers list. The variable num represents each number in the list during each iteration.
Inside the loop, we add each number to the total using the += operator.
After the loop has finished iterating through all the numbers, we calculate the average by dividing the total by the number of elements in the list, which is obtained using the len() function.
We print the list of numbers, the sum of numbers, and the calculated average to the console.
Identifying and Correct Errors
Bugged Program
menu = {"burger": 3.99,
"fries": 1.99,
"drink": 0.99}
total = 0
#shows the user the menu and prompts them to select an item
print("Menu")
for k,v in menu.items():
print(k + " $" + str(v)) #why does v have "str" in front of it?
#ideally the code should prompt the user multiple times
item = input("Please select an item from the menu")
#code should add the price of the menu items selected by the user
print(total)
Our New Program
menu = {
"burger": 3.99,
"fries": 1.99,
"drink": 0.99
}
bill = []
# Display the menu
print("Menu")
for item, price in menu.items():
print(f"{item}: ${price:.2f}")
while True:
item = input("Please select an item from the menu (or enter 'done' to finish): ").lower()
if item == 'done':
break
if item in menu:
bill.append(menu[item])
print(f"{item.capitalize()} added to the bill.")
else:
print("Invalid item. Please select an item from the menu or enter 'done' to finish.")
if bill:
total_cost = sum(bill)
print(f"Your total bill amount is: ${total_cost:.2f}")
else:
print("No items selected. Have a nice day!")