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
Help me plss
0 Votes
Android studio emulator
0 Votes
Return function
1 Votes
help me
0 Votes
Can anyone guide me
0 Votes
Internal vs external JS
1 Votes
i need help
0 Votes
Snake game
0 Votes