Waheeb Algabri
numbers = [1, 2, 3, 4, 5]
print(numbers[1:-5])
Can you debug and fix the output? The code should return the entire list
numbers=[1,2,3,4,5]
print(numbers[0:5])
[1, 2, 3, 4, 5]
def sales_tracker():
weekdays = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
tracker = {}
total_sales = 0 # Initialize a variable to store the total sales
for day in weekdays:
sales = int(input(f'Please enter the amount of sale for {day}: '))
tracker[day] = sales
total_sales += sales # Add the daily sales to the total_sales
return tracker, total_sales
tracker, total_weekly_sales = sales_tracker()
print("Sales Data for the Week:")
print(tracker)
print("Total Sales for the Week:", total_weekly_sales)
Please enter the amount of sale for Monday: 3000
Please enter the amount of sale for Tuesday: 2500
Please enter the amount of sale for Wednesday: 1700
Please enter the amount of sale for Thursday: 1900
Please enter the amount of sale for Friday: 3000
Please enter the amount of sale for Saturday: 3500
Please enter the amount of sale for Sunday: 4000
Sales Data for the Week:
{'Monday': 3000, 'Tuesday': 2500, 'Wednesday': 1700, 'Thursday': 1900, 'Friday': 3000, 'Saturday': 3500, 'Sunday': 4000}
Total Sales for the Week: 19600
● Print your list in its original order.
● Use the sort() function to arrange your list in order and reprint your list
● Use the sort(reverse=True) and reprint your list
travel = ["Yemen", "Jordan", "Qater", "Italy", "UK"]
print(travel)
travel.sort()
print(travel)
travel.sort(reverse=True)
print(travel)
['Yemen', 'Jordan', 'Qater', 'Italy', 'UK'] ['Italy', 'Jordan', 'Qater', 'UK', 'Yemen'] ['Yemen', 'UK', 'Qater', 'Jordan', 'Italy']
number_room = {607:520, 606:286, 602:521, 604:321}
number_instructor_time = {602:["Schettini","6:00 PM EST"], 604:["Fulton", "6:30 PM EST"], 606:["Briar", "8:00 PM EST"], 607:["Catlin", "6:45 PM EST"]}
def course_summary():
course_number = int(input("Please enter a course number: "))
print(f"The course number {course_number} meets in room {number_room[course_number]} and has the instructor {number_instructor_time[course_number][0]} and meets at {number_instructor_time[course_number][1]}")
course_summary()
Please enter a course number: 602 The course number 602 meets in room 521 and has the instructor Schettini and meets at 6:00 PM EST
● look up a person’s email address,
● add a new name and email address,
● change an existing email address, and
● delete an existing name and email address.
name_email = {"Waheeb":"Waheeb.Algabri@sps.cuny"}
def name_email_call():
actions = ["look up","add","change","delete"]
user_input = input(f"Please choose an action out of {actions}: ")
if user_input == "look up":
print(name_email[input("Please enter the name whose email address you want to look up: ")])
elif user_input == "add":
new_name = input("Please enter the name of the user you would like to add: ")
new_email_address = input(f"Please enter the email address of {new_name}: ")
name_email[new_name] = new_email_address
print(name_email)
elif user_input == "change":
change_name = input("Please enter the name of the user you would like to edit: ")
change_email_address = input(f"Please enter the new email address of {change_name}: ")
name_email[change_name] = change_email_address
print(name_email)
elif user_input == "delete":
delete_name = input("Please enter the name of the user you would like to delete: ")
del name_email[delete_name]
print(name_email)
else:
print("That was an invalid command")
exit()
name_email_call()
Please choose an action out of ['look up', 'add', 'change', 'delete']: add
Please enter the name of the user you would like to add: Kayleah
Please enter the email address of Kayleah : Kayleah.sps.cuny
{'Waheeb': 'Waheeb.Algabri@sps.cuny', 'Kayleah ': 'Kayleah.sps.cuny'}