The closest answer is `if status == 201:` & `else:` as everyone already stated.
The problem here is the `status` variable is no where to be found.
This is probably a typo, the correct statement should be `response.status_code == 201`
- The body of if is executed only if this evaluates to create the route or if the status is equal to 201
if = status == 201 (HTTP 201 is CREATED) = correct
- So, if the route is I52not be created, the body of else is executed
else: = correct
Note: if-else statement evaluates the Boolean expression. If the condition is TRUE then, the code present in the “ if “ block will be executed otherwise the code of the “else“ block will be executed
Wrong
if response == 601 = there is no 6xx HTTP code
elif is used to include multiple conditional (and it is not this case)
when is used to run a block of code whenever, during the execution of the program, a condition is met or related to an event (and it is not this case)
upvoted 2 times
...
This section is not available anymore. Please use the main Exam Page.350-901 Exam Questions
Log in to ExamTopics
Sign in:
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
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.
FR99
Highly Voted 3 years, 3 months agoblezzzo
Highly Voted 3 years, 3 months agowhipmuffin
Most Recent 6 months, 2 weeks agoTeringzooi
1 year, 2 months agodesignated
1 year, 3 months ago