This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
print("Hola mundo") | |
print("Hola de nuevo") | |
print("Me gusta escribir esto") | |
print("Si! Escribiendo.") | |
print("Seguro que a ti no") | |
print("I said do not touch this") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A comment, this is so you can read your program later. | |
# Anything after the # is ignored by python | |
print("I could have code like this") # and the comment after is ignored. | |
# You can use a comment to "disable" or comment out a piece of code: | |
# print("This won’t run") | |
print('This will run.') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cars = 100 | |
space_in_a_car = 4.0 | |
drivers = 30 | |
passengers = 90 | |
cars_not_driven = cars - drivers | |
cars_driven = drivers | |
carpool_capacity = cars_driven * space_in_a_car | |
average_passengers_per_car = passengers / cars_driven | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
print("I will now count my chickens") | |
print("Hens", 25 + 30 / 6) | |
print("Rossters", 100 - 25 * 3 % 4) | |
print("Now I will count the eggs:") | |
print(3 + 2 + 1 - 5 + 4 % 2 - 1 / 4 + 6) | |
print("Is it true that 3 + 2 < 5 - 7?") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
my_name = "John Doe" | |
my_age = 37 # not a lie | |
my_height = 180 # centimeters | |
my_weight = 80 # kilos | |
my_eyes = 'brown' | |
my_teeth = 'White' | |
my_hair = 'Brown' | |
print(f"Let's talk about {my_name}.") | |
print(f"He's {my_height} centimeters tall.") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
types_of_people = 10 | |
x = f"There are {types_of_people} types of people." | |
binary = "binary" | |
do_not = "don't" | |
y= f"Those who know {binary} and those who {do_not}" | |
print(x) | |
print(y) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
print("Mary had a little lamb.") | |
print("It's fleece was white as {}.".format('snow')) | |
print("And everywhere that Mary went.") | |
print("." * 10) # What'd that do? | |
end1 = "C" | |
end2 = "h" | |
end3 = "e" | |
end4 = "e" | |
end5 = "s" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
formatter = "{} {} {} {}" | |
print(formatter.format(1, 2, 3, 4)) | |
print(formatter.format("one", "two", "three", "four")) | |
print(formatter.format(True, False, False, True)) | |
print(formatter.format(formatter, formatter, formatter, formatter)) | |
print(formatter.format( | |
"Try your", | |
"Own text here", | |
"Maybe a poem", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Here's some new strange stuff, remember type it exactly. | |
days = "Mon Tue Wed Fri Sat Sun" | |
months = "\n Jan\nFeb\nMar\nApr\nMay\nJun\nJul\nAug" | |
print("Here are the days:", days) | |
print("Here are the months", months) | |
print(""" | |
There's something going on here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tabby_cat = "\tI'm tabbed in." | |
persian_cat = "I'm split\non a line" | |
blackslash_cat = "I'm \\ a \\ cat." | |
fat_cat = """ | |
I'll do a list: | |
\t* Cat food | |
\t* Fishies | |
\t* Catnip\n\t* Grass | |
""" |
OlderNewer