Python Programming Basics: Print, Variables, Comments and Strings

Python Comments

# Comments tell a computer to ignore a part of the program. The code or comments will not run by the computer: these are called code comments.  Python interprets anything after the # symbol as a comment.

# This is a python comment

Python Print

Python print function lets you tell the computer what to say. Make sure that you message you want to display is surrounded by quotes, otherwise it will through a SyntaxError.


# In Python you can output a string of text by using double-quotes "" or '' single-quotes. Just remember that the quotes have to be the same for each string, if not it will throw a SyntaxError  


#Bad - print("bad') - will throw SyntaxError because of mismatched statement quotes

#Good - print("good") or ('good')


# We are going to output something. In python this is done by using print

print ("Howdy Earthlings")

Python Variables

#Variables let you reuse code by storage data to be easily changed and reused.


#Assigning variables is done by using the equals sign =


#Python variables can't have spaces or symbols in their names, though you can use underscores _ . They also can't start with number, you can use numbers in the variables, but just not as the first character.


#Good - my_awesome_666varible

#Bad - 666_my_aweomsevariable


#message_string is our variable

message_string = "Howdy Earthlings"

# Prints "Howdy Earthlings"

print(message_string)

Python Strings

# Programming often calls a character text block as strings.


# In Python you can output a string of text by using double-quotes "" or '' single-quotes. Just remember that the quotes have to be the same for each string, if not it will throw a SyntaxError  


# In the code below the string is Amie, because it is in the quotes block 'Amie'


print('Amie')

print("Amie")


Wiring and Schematics

Download Template

3D Printer Settings

Code

Things Used
AmieDD Software

Either will work.

AmieDD Software
AmieDD Machines and Tools
AmieDD Character
AmieDD Cosplay Fandom

More Tutorials

I make everything with love and a few curse words.