+ 2
How to access a variable from another class
Hello so basically i need to access a variable called 'forwdd' from function 'move_forward' from class Turtle to new function 'print_distance' in new class called 'TurtleGTX'. And i have attached my try. Please help🙏 https://code.sololearn.com/c6YC3wv49Tyj/?ref=app
2 Réponses
+ 3
define it as instance variable in init with value 0 and change it in the function.
Thats all😉
0
Ty Oma Falk it works