Last active
November 1, 2023 23:07
-
-
Save joetechem/0f500f3e8f219a95f2ab9e7a42786fe1 to your computer and use it in GitHub Desktop.
the hello world program using the python language. A classic intro to programming.
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
# Python 2.7 | |
# let's have the computer tell us "hello world!" | |
# Remember, a computer program is a set of instructions we tell the computer what to do. | |
print("Hello World!") | |
# When we run the program, Python returns the string inside the parentheses | |
# a string is just any series of letters, numbers, or symbols. Think of it as a line of text. | |
# The print(), is a function. If you've played Lightbot, function is another word for a procedure | |
# a function is just a block of code to perform a specific task and we can reuse | |
# Variables: | |
message = "Hello World!" | |
print(message) | |
# Line 15 and 16 outputs the same information as line 5, we just put the string into a variable | |
# A variable is just a placeholder for information | |
# In this case, Python will recognize message as that string | |
# Loops: | |
# We've already learned that one way we can repeat code is by using a loop | |
# What if we wanted to print "Hello World!" 10 times | |
# Sure, we could type print("Hello World!") 10 times, on ten different lines, then run the program | |
# But, this technique could take a long time! | |
# Instead, we can use the loop function, one such loop we could use is the for loop | |
# Let's see this in action: | |
for i in range(10): | |
print("Hello World!") | |
# When we run line 30 and 31, Python will return the string, 'Hello World!' 10 times! Mission Accomplished! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
import math
from turtle import*
def hearta(k):
return 15math.sin(k)**3
def heartb(k):
return 12math.cos(k)-5*
math.cos(2k)-2
math.cos(3k)-
math.cos(4K)
speed(1000)
bgcolor("black")
for i in range(6000):
goto(hearta(i)*20,heartb(i)*20)
for j in range(5):
color("#f73487")
goto(0,0)
done()