Answered step by step
Verified Expert Solution
Question
1 Approved Answer
What's wrong with my code? I ' m struggling to find out where I am going wrong and would love advice. Changed it about 8
What's wrong with my code?
Im struggling to find out where I am going wrong and would love advice. Changed it about times and can't figure it out.
My code:
def findlargest:
printPlease enter numbers and this program will display the largest."
largest None
for i in range:
while True:
try:
num intinputfPlease enter number i:
if num:
break
else:
printPlease enter a positive integer."
except ValueError:
printPlease enter a valid integer."
if largest is None or num largest:
largestnum
printfThe largest number was largest
# Call the function to execute
findlargest
Pycharm Output
Pycharm Outcome:
Please enter numbers and this program will display the largest.
Please enter number :
Please enter number :
Please enter number :
Please enter number :
Please enter number :
Please enter number :
Please enter number :
Please enter number :
Please enter number :
Please enter number :
The largest number was
Process finished with exit code
EOFError:
Traceback most recent call last:
File autogradersourceLabApy line in
findlargest
File autogradersourceLabApy line in findlargest
num intinputfPlease enter numberi:
EOFError: EOF when reading a line
Traceback most recent call last:
File autogradersourceLabApy line in
findlargest
File autogradersourceLabApy line in findlargest
num intinputfPlease enter numberi:
EOFError: EOF when reading a line
Traceback most recent call last:
File autogradersourceLabApy line in
findlargest
File autogradersourceLabApy line in findlargest
num intinputfPlease enter numberi:
EOFError: EOF when reading a line
python: can't open file autogradersourceLabBpy: Errno No such file or directory
python: can't open file autogradersourceLabBpy: Errno No such file or directory
python: can't open file autogradersourceLabBpy: Errno No such file or directory
python: can't open file autogradersourceLabBpy: Errno No such file or directory
python: can't open file autogradersourceLabCpy: Errno No such file or directory
python: can't open file autogradersourceLabCpy: Errno No such file or directory
python: can't open file autogradersourceLabCpy: Errno No such file or directory
python: can't open file autogradersourceLabCpy: Errno No such file or directory
Websites IDE:
Expected:
Please enter numbers and this program will display the largest.
Please enter number :
Please enter number :
Please enter number :
Please enter number :
Please enter number :
Please enter number :
Please enter number :
Please enter number :
Please enter number :
Please enter number :
The largest number was
Your Output:
Please enter numbers and this program will display the largest.
Please enter number: Please enter number: Please enter number: Please enter number: Please enter number: Please enter number: Please enter number: Please enter number: Please enter number: Please enter a positive integer.
Please enter number: Please enter a positive integer.
Please enter number:
I've rewritten the code multiple times based on the power point slides my school gives. Ran it through both Pychart and Replit which it ran correctly.
What I am expecting is the code to run the same on pychart, replit and Gradescope.
original assignment python
LabA: Largest of
For this lab, please use a for loop. The goal of this exercise is for you to create a program that will ask the user to input positive integer numbers, one at a time. While it does this the program should also keep track of the largest number it has seen so far. After it has run times, it should display the largest number you input.
The user input is indicated in bold.
Sample output:
Please enter numbers and this program will display the largest.
Please enter number :
Please enter number :
Please enter number :
Please enter number :
Please enter number :
Please enter number :
Please enter number :
Please enter number :
Please enter number :
Please enter number :
The largest number was
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started