Skip to main content

Chapter 1a - Printing

Printing Messagesโ€‹

print ("Hello World!")  # Print a message using double quotes
print ('Hello World!') # Print a message using single quotes
๐Ÿงช Try the code out!
Time to work on our Japanese Emoticons!

Click here to go to our Japanese Emoticons project You only need to complete this for this class. But if you would like to, feel free to peek into the topics below!

Printing numbersโ€‹

# This program displays some stuff 
print ("Welcome to Python Programming")
print ("Try coding, it's fun. Do you know what is 4*3?")
print (4*3) # This should print 12
๐Ÿงช Try the code out!

Special Characters when Printingโ€‹

๐Ÿ‘€

print('Hello\n World') # Move to the next line after Hello
print('') # Leave an empty line on console
print('Hello\nWorld') # Move to the next line after Hello, white space before World has been removed here

print('\nDemonstration of backslash')
# print('\') # uncommenting this line will cause an error
print('\\') # to print a backslash, you need to escape with another backslash
๐Ÿงช Try the code out!

๐Ÿ‘€

Exampleโ€‹

Printing a Human Character

Let's say we want to create the following figure:

๐Ÿ”ฌ Solution
Try out this solution
Problem 1

Let's say you want to create the following figure:

๐Ÿ“ Solve this problem in Trinket or here
๐Ÿ’ก Hints
  • What are the different characters that have been used to create this shape?
  • How will you get the spacing right? What lines are the characters on? Hint: Use a table and add the different characters in the cells as they appear in the image. Or simply align the characters on your code editor first.
  • Write down the instructions needed to create this graphic in the Instructions window of your Trinket.

๐Ÿ‘€

๐Ÿ‘€Assessment Quiz