I think A,D
return will have the same effect of None, but return will made a return to a function call, that is different then do nothing as the question ask.
This is a dumb question. return, pass, and None will all work. It kinda just depends on how you want to do it. pass is probably to best to use, since it pretty clearly indicates youre just moving on. return will implicitly return None, and so will None. I guess Id give the edge to None over return just because its slightly more clear but its a function that does nothing, who cares?
AB
You can use the pass keyword to create a function that does nothing and just returns control to the caller, or you can use the return statement without any value to exit the function and return None. The exit function is used to terminate the program, not to create a function that does nothing.
A. pass
D. None
The pass and None keywords can be used to define a function that does nothing. The pass keyword can be used as a placeholder for code that has not yet been implemented, or as a way to create an empty block of code. The None keyword represents the null value and can be used to indicate that a function does not return a value. In the case of the idler function, using either pass or None as the body of the function will cause the function to do nothing when it is called.
Options : A,B,C & D will all return the same empty result on the console prompt.
But None is over-writing the output and exit will exit the function, thus i would go with A & D.
A. pass - Will do nothing
B. return - Will return nothing
C. exit - Will exit the program
D. None - "None" refers exactly to the intended functionality - it is nothing, and has no behaviour.
Answer should be AB
D would work but any constant like None, True, False, 3, 5.333 would work but this is not specific to a function, you could place them at the shell prompt and it would work the same
D should not be even on the list when B is included, B takes the precedence over D
A. pass - Will do nothing
B. return - Will return nothing
C. exit - Will exit the program
D. None - "None" refers exactly to the intended functionality - it is nothing, and has no behaviour.
A & D seem to be fine.
I think you do not have a clue about basics of programming. If you put just 'None' on the line it will be translated into 'None' followed by 'return' anyway. Any function will always have 'return' at the end, it is implied. So by definition, if a function has only 'return' then it does nothing because 'return' is always added anyway and it is redundant. Most importantly, the actual exam would never include a question with such overlapping answers
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
Oracleist
9 months, 3 weeks agoTheFivePips
11 months, 3 weeks agoAcid_Scorpion
1 year, 1 month agoEltonAuguston
1 year, 5 months agowedlive
1 year, 7 months agoryanzou
1 year, 8 months agoMallie
1 year, 11 months agoAdeshina
1 year, 11 months agoagus007
2 years agoPremJaguar
2 years, 4 months ago666_m
2 years, 6 months agomacxsz
2 years, 6 months agorocky48
2 years, 8 months agorocky48
2 years, 8 months agoBacky
2 years, 9 months agorocky48
2 years, 8 months agoBacky
2 years, 7 months agosmarty_arse
2 years, 10 months ago