+ 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
3 Answers
+ 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