Skip to content

Adding UTF-8 explanation to prints #29

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions sampleprint.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# coding: utf-8

# prints an empty space since comments are ignored
print #"Hello World!"

Expand Down Expand Up @@ -32,3 +34,17 @@
print "We can transport", carpool_capacity, "people today."
print "There are only", drivers, "drivers available."
print "There are", cars, "cars available."

# In all these lines of code, one thing got lost in the process:
# the first line. When we code, most of the things are wrote in
# english, but sometimes we need those things in another language.
# Languages like Portuguese and Spanish have accents, special
# characters and some other stuff that, when we try to print,
# its outputed wrong. To correct that, in the first line of the
# code, we simply add a comment, on the first line, with the sentence
# "coding: utf-8", as we can see on this file. Adding it, we can
# print sentences like:

print "Olá mundo!" # portuguese for "Hello World!"