I'm taking a Python class, and I don't know anything, but they want me to submit it for an interim evaluation.
Can someone help me?
[Conditions]
python
def calculator(numbers):
if type(numbers) != "list":
raise ValueError
length = len(numbers)
total = 0
for num in numbers:
total += num
return length, total
# When entering a list containing numbers, 1) length of the list, 2) return the sum of the numbers
numbers = [1,2,3]
print(calculator(numbers))
# Error occurs when numbers enter str type
numbers = "1,2,3"
print(calculator(numbers))
Is there a reason for taking a lectureing? Aren't you looking at the questions to code them? Listen to the class hard :)
887 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
610 Uncaught (inpromise) Error on Electron: An object could not be cloned
577 PHP ssh2_scp_send fails to send files as intended
599 GDB gets version error when attempting to debug with the Presense SDK (IDE)
© 2024 OneMinuteCode. All rights reserved.