So I cannot understand the meaning of the function has a value.
Also, there is a problem with users[username] == password, I cannot understand that like I tried to run. Is it “Prateek” or “Coding Blocks” in the dictionary? if you are not getting the dictionary example sir has explained to us in the video you can watch that. Can you also explain this?
In line 3 first there is a function call to show() function thus is prints and output Hello World, now after the function call as the function don’t have a return type None type is returned after the function call. Thus your assertion statement will look like this —> None == 45 and it is a false statment thus if you had wriiten print(show()==45) Output might had been a bit different i.e.
Output :
Note: This output only signifies to the statement print(show()==45)
3.In line 4 your code will be executed in the similar way as if it would have been written as print(print("Hello World"))
And thus you will get the following output :
It is so because first it perform the inner operation which is print(“Hello World”) and it prints Hello World. Then it performs the outer operation and prints None because the inner print is returning None to the outer print statement.
**in the example used by the mentor both key and its value were in lower case; camel case wasn’t used
Both “prateek” or “coding blocks” are a part of dictionary, “prateek” represent a key in the users dictionary whereas “coding blocks” acts as value of “prateek” key in the users dictionary.
Behind the scene what’s happening over here is that; Its an assertion statement , suppose the we take username as “prateek” so what this statement will be going to do is do a look up for the key “prateek” in the users dictionary and once it find it will return the value of “prateek” key (as in this case it happens to be “coding blocks”)
In our example we take password as “coding blocks” thus now your statement will look like: “coding blocks” == “coding blocks”
thus its a True statement
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.