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
[SOLVED] Ballpark Challenge
1 Votes
Who will
0 Votes
HELP. UNFAIR STREAK LOSS
2 Votes
There is an error.
0 Votes
AMA series
1 Votes