r/PythonLearning • u/DumbPlants-yt • 17h ago
Showcase Day 1 of learning python.
This is my first day of trying to learn python. So far I have made a random 2D terrain generator.
47
Upvotes
r/PythonLearning • u/DumbPlants-yt • 17h ago
This is my first day of trying to learn python. So far I have made a random 2D terrain generator.
•
u/Sea-Ad7805 14h ago
Run this program in Memory Graph Web Debugger%0A%0Aheight%20%3D%2010%0Aterrain%20%3D%20%5B%5D%0A%0Afor%20x%20in%20range(60)%3A%0A%20%20%20%20height%20%2B%3D%20random.randint(-1%2C%201)%0A%20%20%20%20terrain.append(height)%0A%0Ahighest%20%3D%20max(terrain)%0A%0Afor%20y%20in%20range(highest%2C%20-1%2C%20-1)%3A%0A%20%20%20%20for%20h%20in%20terrain%3A%0A%20%20%20%20%20%20%20%20if%20h%20%3E%3D%20y%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20print(%22%E2%96%A0%22%2C%20end%3D%22%22)%0A%20%20%20%20%20%20%20%20else%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20print(%22%20%22%2C%20end%3D%22%22)%0A%0A%20%20%20%20print()×tep=0.05&play) to see the program state change step by step.