Share your repls and programming experiences

← Back to all posts
Farm Generator
MrTrex (17)

This program will generate wheat in random positions, like a farm
(Scroll up if you want to see the whole farm)

Spacecraft (152)

This is clever, nice job.
May I offer a suggestion? I learned in my first programming class long ago that if you find yourself copy/pasting the exact same thing 600 times, you may be missing one of the fundamental points of writing code. You can accomplish the same thing with some minor changes and a very simple FOR loop:

import random

farm_character = ["🌾", ""]

def generate():
    for i in range(1000):
        print(random.choice(farm_character),end = ' ')

choice = 'y'
while choice == 'y':
    choice = input('''Generate again y/n: ''')

This was useful advice to me and I thought I would pass it along. Happy coding.