#100DaysOfCode - Day 1

Day 1 - Band Name Generator

·

2 min read

Okay, this wasn't a difficult one to write.
It was called Band Name Generator and the idea was that my code asks two questions of the user to and generates a Band Name from the answers.

Of course, there is more to it than that. Learning to print to console, presentation of the print, getting user input, creating variables, and generating the output.
I played around with the questions I would ask and settled on two, and to add a little more I imported system from os to add in a couple of console clearing lines to enhance the presentation and a couple of blank line breaks.

One point raised in the lecture was ensuring that the point where the user would enter their suggestion was correct. Not just an input command of a simple string question, and then the cursor sits just beside the last printed character.
To resolve this I always do two things. End the string with a space and add a line break '\n' For me, this gives me something that is easier to read on how the print will present in the console.

Oh, and I stuck it all inside a function.

# band_name_generator.py
'''
    A name generator using a couple of pieces of input from the user
'''
from os import system
def name_generator():
    system('cls')
    print('Band Name Generator')
    print('*******************')
    place = input('Name your favourite place: \n')
    food = input('What is your favourite food? \n')
    system('cls')
    print()
    print(place, food)
    print()

if __name__ == "__main__":
    name_generator()