Aug-15-2018, 12:55 PM
Hi Python mentors,
I tried running this code:
It works okay in Jupyter though. Is it because the file ends in .ipynb?
Do you have any idea what's causing this?
Thank you.
==============================================================================
[Image: 00_zpsce01yh8k.png]
[Image: 01_zpsqpwxtmt5.png]
I tried running this code:
import random M = 'land' o = 'water' h = 11 #number of rows w = 11 #number of columns matrix = [] world = [ [o,o,o,o,o,o,o,o,o,o,o], [o,o,o,o,M,M,o,o,o,o,o], [o,o,o,o,o,o,o,o,M,M,o], [o,o,o,M,o,o,o,o,o,M,o], [o,o,o,M,o,M,M,o,o,o,o], [o,o,o,o,M,M,M,M,o,o,o], [o,o,o,M,M,M,M,M,M,M,o], [o,o,o,M,M,o,M,M,M,o,o], [o,o,o,o,o,o,M,M,o,o,o], [o,M,o,o,o,M,o,o,o,o,o], [o,o,o,o,o,o,o,o,o,o,o] ] def gen_maze(): rows = [] for i in range(w): matrix.append([]) col = [] for j in range(h): # matrix[-1].append(0) value = random.choice(['o', 'M']) col.append(value) rows.append(col) return rows gen_maze()but it wouldn't run either Cmder or Anaconda Prompt?
It works okay in Jupyter though. Is it because the file ends in .ipynb?
Do you have any idea what's causing this?
Thank you.
==============================================================================
[Image: 00_zpsce01yh8k.png]
[Image: 01_zpsqpwxtmt5.png]
Blockchain Visionary & Aspiring Encipher/Software Developer
me = {'Python Learner' : 'Beginner\'s Level'}
http://bit.ly/JoinMeOnYouTube
me = {'Python Learner' : 'Beginner\'s Level'}
http://bit.ly/JoinMeOnYouTube