0

What is the meaning of the following expression:

assert "PASS" == res, msg

Which argument is being evaluated here?

manish ma
  • 1,706
  • 1
  • 14
  • 19

1 Answers1

2

The assert keyword is used when debugging the code.

This keyword test a condition (which is the first argument), if the condition returns false the program will give an AssertionError, you can write the AssertionError message (which is the second argument, separated with ,).

Ex:

password = "hello"

assert password == "goodbye", "Access Denied"

output of the above code is:

AssertionError: Access Denied

Sahadat Hossain
  • 3,583
  • 2
  • 12
  • 19
  • Also your assertion makes no sense. You assert that the value is `goodbye` and print that it should be `hello` if it wasn't `goodbye`. I mean, thee password actually ***is*** hello and your message says it should be hello – Tomerikoo Jan 14 '21 at 12:44