On day 1 of my 100 days of code journey I learned how to use string manipulation, variables and the len, print and input function.
For example:
print("Hello " + input("What is your name? "))
The above line of code prompts you to enter your name and then greets you with a hello, followed by your name.
print(len(input("What is your name? ")))
By using the len function (short for length) I was able to return the number of characters that you enter as your name. For example, entering "John" will print the number 4 to the console.
name = "Henry"
print(name)
The above line of code stores a string in a variable. By using the print function and referring to the variable name in the parentheses I was able to print the value that the variable was holding, to the console, i.e. "Henry".
Finally to finish off the day I created a band name generator. It works by asking you 2 simple questions. The city you grew up in and the name of your pet. It then combines these 2 values to give you a name for a music band, or any type of group.
Top comments (0)