can u plz tell me what is use of try,except,finally and how & where we exactly use these
Try,except,finally?
hey @Ashu1318 ,
these three form a trio to complete some task together.
lets assume that you have some code that takes input from a keyboard , and perform something .
In this code you have snippet as such , whether you get an input from the keyboard or not , it will work and it has to work also to get your task done without any problem.
So what we do is like
try :
code here that will read input from keyboard
except :
By chance you received an error due to which you didn't get any input and hence to not stop the programm functioning you wrote some code here
finally:
now here the code comes that have to be run always to complete the functioning of the programm
In this way all these three work altogether,
i hope this helped you understand it a bit.
okay now i got it ,also can u plz tell me how to pass a list or tuple in function argument by refrence
most times i have found that we just the update the list we are passing , and do not return anything and keep the name same over whole code , in this way it updates that particular list only like a reference.
for more ,
have a look here https://stackoverflow.com/questions/48363057/how-to-pass-a-list-by-reference
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.