It's an Indenting Error.
When you're indenting use TABS not SPACES.
If you would like to change that press the gear icon in the menu on the left.
Fixed Code https://repl.it/@LynnOng/Fixed-Thing
If you're looking to generate worlds then feel free to implement this program into your code.
It generate things based on the samples given.