Day 01

printing and variables -Pet name generator

To a complete newbie, the first thing that would blow his mind, would be having anything printed on the black terminal screen. Full hacker vibes I tell you.

Print

In python the keyword 'print()' is what's used to display any information to the user.

image.png


print("Hello World")  #String need quotations
print('Hello World')  #Single or double quotations
print("Hello 'World' !")  #To have quotes within quotes use different ones
print(13)  #Numbers don't need quotes

Variables

Variable are used to store a piece of code or value under a label which can be used later on your code. In python, by convention we use snake_case to for variable names. To declare a variable, simply assign the value to the name.

my_var_name = "WiFi"

Input

Along with just printing and storing data, we also need a way to get the data from the user. We do this through the 'input()' function. The value it receives can be stored to a variable or used directly.

#using it directly in code
print("Hello" + input("What is your name"))

#saving it to a variable
name = input("What is your name?")
print("Hello" + name)

Project - Pet name Generator

image.png

01-op.png

01-ip.png