100 days of Code. Day 1

I decided to finally start the Udemy Course 100 Days of Code – The Complete Python Pro Bootcamp for 2021. My goal is to do this daily and if time permits, share my comments and projects for the day on this site.

This Udemy course starts without needing Python installed as we are leveraging a website called Replit. This is a site where we can focus on writing code and build apps by using the browser. No need to worry about Python versions, dependencies or environments… just code away. Pretty neat.

For more about Replit: https://replit.com/site/about

My replit repo https://replit.com/@mackyruiz

Day 1 went over the variables and the print and input functions

The program below was written to switch the variables. User provided a value, then we switched and printed it.

Code:

a = input("a: ")
b = input("b: ")

c = a
a = b
b = c

print("a: " + a)
print("b: " + b)

Output:

$ python3 var-switch.py 
a: 6
b: 7
a: 7
b: 6

The final project for the day was to create a name generator by combining the print and input function, along with concatenating strings and variables together:

#1. Create a greeting for your program.
print("Welcome to the Band Name Generator.")

#2. Ask the user for the city that they grew up in.
city = input("What's the name of the city you grew up in?\n")

#3. Ask the user for the name of a pet.
pet = input("What's your pet's name?\n")

#4. Combine the name of their city and pet and show them their band name.
print("Your band name could be " + city + " " + pet)
print("")

Output:

$ python3 BandNameGen.py 
Welcome to the Band Name Generator.
What's the name of the city you grew up in?
San Jose
What's your pet's name?
Fluffy
Your band name could be San Jose Fluffy