New course! Every coder should learn Generative AI!
Try a free lessonQ&A Discussions
😬 Warning / Errors
32 Votes
14 AnswersCan you find errors
0 Votes
1 AnswerWrong answers
2 Votes
3 AnswersPython Program Errors
1 Vote
1 AnswerWhat are logical errors?
2 Votes
4 AnswersIn the code below the output is 2. This code is used in a challenge and I get an error when I select the answer 2. It accepts as correct the answer 1 which I believe is wrong. If you agree please thumbs up.
If you find any other errors please post them here!
#include <iostream>
using namespace std;
int main()
{
for(int i=1; i>=1; i++) {
if(i<1 || i>1){
cout << i;
break;
}
}
return 0;
}
8 Votes
8 AnswersIf except can handle common errors very well, doesn't that make the use of raise redundant inside of a try-except block?
For example:
try:
print( 5 / 0 )
except ZeroDivisionError:
raise ValueError("An error occurred!")
What's the difference if we handle it this way:
try:
print( 5 / 0 )
except (ZeroDivisionError, ValueError):
print("An error occurred!")
3 Votes
2 AnswersHot today
Am new in learning programming
1 Votes
Where do i write my code?
0 Votes
how do i load the Apl
2 Votes
Input Mismatch Error in Java
0 Votes
C++
0 Votes
A new bug or an exception?
1 Votes
Phyton for beginners
0 Votes