Skip to content

Instantly share code, notes, and snippets.

@DaraDDB1
Last active January 17, 2018 10:42
Show Gist options
  • Save DaraDDB1/1527c756a0635da9f53ef8f25bf4edae to your computer and use it in GitHub Desktop.
Save DaraDDB1/1527c756a0635da9f53ef8f25bf4edae to your computer and use it in GitHub Desktop.
#Welcome to Dara's program checklist
while True: #will loop everything thats indented below it
from time import sleep #makes sleep accessable
#1. Print statements
print("Hi, my name is Dara")
#this prints the users message. OUTPUT:
#Hi, my name is Dara
#2. Sleep
#You need to write: "from time import sleep" at the very top of the code
#This will activate the sleep code. You use it like this:
sleep(2) #will pause the code for 2 seconds
#3. Inputs
choice=input("What is your favourite colour?")
#this lets the user type and answer!!
#output:
#whats your favourite colour? "answer"
#4 While Loop
#need to put at top of code also
#you type while True:
#this will loop the entire code
#DO NOT FORGET TO INDENT
#5. If else
if choice == "pink":
print("you chose " = choice)
#this means that if you typed pink, itll say:
#you chose pink
else:
print("Thats a pretty colour")
#this means that if you typed anything other than pink, itll say its a pretty colour
#6. functions
#this is how you declare a function:
def(funkyfunctions):
print("hiiiii")
#this means that if you type funkyfunctions, itll say hiiii
#output:
#funkyfunctions
#hiiiii
#7. lists
list(apples, cereal) #this just shows you whats in the list
output:
#list()
#apples, cereal
#8. for loops
#not quite sure how to do this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment