Both of those look problematic, can you provide details of the exact error you’re getting. I’m assuming all those terms should have the same indentation? Is there perhaps a mixture of tabs and spaces which is causing the changes when displayed on different platforms? Inconsistent use of tabs and spaces is a nightmare for reasons like this. Adjust your code for the correct indentation, try using only spaces and an perhaps a code editor that automatically converts tabs to spaces for the best results.
Edit: I shifted this into Python since that’s the language used.
Regarding the following lines from the original post, the first has one tab as its indentation, and the second and third each have two tabs:
def __init__(self, name, age, sex, bmi, num_of_children, smoker):
self.name = name
self.age = age
All the other indentations in the program are composed entirely of spaces. You can gradually use the mouse or another technique to select that whitespace in order to observe the size of the selectable units, so that the composition of each of the indentations becomes evident.
Whenever an IndentationError occurs despite the fact that the indentation appears correct, it is a good idea to select the whitespace to investigate its composition.
I’m still not understanding what the solution to this problem is. I’ve tried moving everything to the left side fo the screen and indenting myself. I’ve also tried using spaces. But I can’t seem to get this code to work. Please help me. It’s for the same Python Classes: Medical Insurance Project santiagoqin was having trouble with.
Hey guys had the same issue and tried everything: deleting the indents and then manually using tab to create new ones, the same but with spaces instead etc. What fixed it for me was removing the indent before the init method, running, and then adding the indent back again and running. Have no idea, why it works but it doesn’t throw up the indentation error now.