Reputation: 389
I use "run" button to run the whole body of my code. I also choose the whole body of code and push the "run this cell" button and get different results. I am using "spyder" to write my code. Why is this happening?
Upvotes: 1
Views: 4813
Reputation: 546
@Fairy, a "cell" in spyder is defined by using a special comment
# %% Cell defined here
Are you using this?
Update
@Fairy, you need to use the cell syntax so:
# %% Cell 1
a = 1 # Start of Cell 1
b = 2
print(a*b) # End of Cell 1
# %% Cell 2
c = 1.0 # Start of Cell 2
d = 2
print(a/b) # End of Cell 1
Now you can run cells, that are delimited by the special comment
Upvotes: 7