Introduction

When it comes to just starting out with Python I feel like these are some of the first things a beginner should know how to do, In this lesson we’ll be going of the basics of print, using variables, taking inputs and saving them to a variable. by the end of this lesson you should have a very simple script that changes depending on what you’ve entered.

What Is Print In Basic Terms?

Print can be used to display data that is stored in a “String” type, We are able to tell what is a string simply by seeing quotation marks around the word like “this”. print has many ways to be used such as helping with debugging code (More On That In A Later Guide). For now check out some of the examples provided below.

print("My Name Is: ")
something>username> firstname.py
My Name Is: 

In this example we are using print to display “My Name Is: ” on the screen when our file is executed. However we can make this better by using “variable”.

What Is A Variable In Basic Terms?

A variable is typically used to store data that is created by the user by giving it a value of something. Variables are very useful when it comes to more complex Python applications. For now let’s give it a String Type Value.

name = "Bob"
print("My Name Is: " + name)
something>username> firstname.py
My Name Is: Bob

In this example, We’ve created a variable with the title of “name” and given it a String Type value called “Bob”. Not everyone you meet has the name Bob. However using the input command we can add anyone’s name.

What Is An Input In Basic Terms?

Input can be used to give a prompt that you can type data into and it would save into the variable we previously created.


name = input("what Is Your Name?\n")
print("My Name Is: " + name)
something>username> firstname.py
What Is Your Name?
Sam
My Name Is: Sam

In this example, we were able to add a different name using the input command  and once that you typed your name it would complete the rest of the script.

The Full Code (Very Small)


name = input("what Is Your Name?\n")
print("My Name Is: " + name)