What's wrong with my code? It seems to me that the nature variable isn't being changed by the find_root function. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

What's wrong with my code? It seems to me that the nature variable isn't being changed by the find_root function.

https://code.sololearn.com/cCF5dS7Ar35r/?ref=app

2nd Sep 2022, 3:44 PM
Junior Coder
Junior Coder - avatar
2 Answers
+ 4
Junior Coder, the variable nature in the function is local variable, so first in the function find_nature use the global keyword. Look at the code. https://code.sololearn.com/cuDld4zW6cRe/?ref=app
2nd Sep 2022, 4:04 PM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar
+ 4
TheWh¡teCat 🇧🇬 Thanks for the help! 😊👍
2nd Sep 2022, 4:08 PM
Junior Coder
Junior Coder - avatar