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()
About the author
Titles: Test Consultant | QA Analyst | Test Analyst | Contract Manager | Test Consultant | Special Waste Chemist | Depot Manager | Operations Manager
Traits: Organised | Innovative | Professional | Relish a challenge
Experience: Consultant in Public Transport Smart Ticketing Smartcard Agile or Waterfall Processes Web and Mobile Application testing Operational management experience in chemical handling and traffic management.
I am a Disposable Manager to the casual observer, but scratch the surface and there is a method in my madness.
Bring new skills to others.
Sacrifice your reputation for that better team result.Don't chase glory,
Everyone should work with you,
Not for you.Walk the talk, deliver results as a team, and make sure every employee is proud of the team.
I can be reached by the following: Telephone: 07853 101959 Email: vchealy@gmail.com
Comments
Join the discussionNo comments yet. Be the first to comment.


