I just started learning python with 100 Days of Code: The Complete Python Pro Bootcamp for 2022 by Angela Yu on udemy
it's my first day with the course and i learnt about
the print and input functions and how it works
print("Hello world!")
This line will print Hello world
input("what is your name?")
It will print the phrase inside the quotes and then ask the user to input characters. In this case it will print What is your name? and then the cursor will appear to take input from the user
We can use input function inside print function
for example:
print("Your name is:", input("What is your name? "))
It will print What is your name first and then ask the user to input their name, if the user inputs john, and then it will print the whole string as - Your name is: john
We can concatinate and print multiple strings in python with the +
sign
for example:
print("Hello" + "world")
this will print hello world;
I've build a band-name-generator with python
here is the code:
print("Welcome to the Band Name Generator.")
city = input("What's name of the city you grew up in?\n")
pet = input("What's your pet's name?\n")
print("Your band name could be " + city + " " + pet)
It takes two user inputs their city and their pets name and concatinates them as a single string and prints it as their band name
I'm enjoying this course
If you want to learn with me and want to get more updates about me
please follow me @rhythmsaha
here are my social profiles
- github:@rhythmsaha
- linkedin: @rhythmsaha
- twitter: @_rhythmsaha
Top comments (1)
Good luck shes a really good teacher.