Hello, How can I find someone help me in return a function and variable scope in python !
Hello,
Could you please elaborate more about your problem? do you have any piece of code you could share with us?
Do you have a more specific question?
You can read more here:
https://www.w3schools.com/PYTHON/python_scope.asp
yeah,sure
so in this code block I want to return the function of hashing words and make it as a string
The return
in your hash
function is going to end the function immediately the first time that if
condition is true.
That might be why you only got a 1 letter result.
You want to call your function like this:
print(hash("hash this string"))
You want your function to keep appending to a string or building a list that you will convert back into a string later and return
that once the hash is built.
Good start, keep going!
thank you do much, I want it to building a list that I will convert back into a string later and return
that once the hash is built.
Put your code into this visual step through:
https://pythontutor.com/python-compiler.html#mode=edit
You can step through the code bit by bit and see how it runs.