Monday, 20 April 2015
Monday, 13 April 2015
Saturday, 11 April 2015
Wednesday, 21 January 2015
Wednesday, 10 December 2014
Monday, 8 December 2014
Saturday, 6 December 2014
Saturday, 29 November 2014
functions 2
PrintMailMergeItems:
We used 2 functions to create this program. The user enters a name and the program checks if its in the list. if it isn't in the list it adds the name, username and password.
Monday, 24 November 2014
Wednesday, 12 November 2014
Saturday, 8 November 2014
Saturday, 1 November 2014
Housepoint Calculator
total=0
for i in range(3):
newnumber=int(input("what the new number?\n"))
total += newnumber
print("the total number is:",total)
Saturday, 18 October 2014
Dictionary
Dictionary:
an_example_dictionary ={1:"No Way!",2:"Hatchee How",3:"wambambam",4:"Pow!"}
print(an_example_dictionary)
print(an_example_dictionary[3])
an_example_dictionary2 ={"1":"No Way!","2":"Hatchee How","3":"wambambam","4":"Pow!"}
print(an_example_dictionary2)
print(an_example_dictionary2["3"])
2nd way:
dictionary={}
dictionary['1']=['a','b','c']
print(dictionary)
dictionary['2']=['d','e','f']
print(dictionary)
3rd way:
dictionary_non_literal={}
dictionary_non_literal[1]=['a','b','c']
dictionary_non_literal[2]=['a1','b1','c1']
print(dictionary_non_literal)
Wednesday, 1 October 2014
Siri with a Tuple
I changed my siri to use a tuple:
#Siri!!
restart = 'y'
while restart=='y':
import random
user_name = input("What is yor name?\n")
#Write answers in a tuple.
answer=(
"Sure Thing",
"Why not",
"Siri Aproves",
"HaHa Nice!",
"Go for it",
"So Cool!",
"I'm Siri",
"Cool Story",
)
print ("Hi",user_name)
print ("Meet Siri.")
#get the users questions.
question= input ("Ask me for advice then press ENTER to shake me?\n")
print ("Shaking...\n"*4)
#Create a dice.
choice=random.randint(0,7)
#Print answer to the screen then restart
print (user_name,"You asked -",question)
print("Siri says:\n",answer[choice])
restart= input("\n\n Press y key to to play again\n")
#Siri!!
restart = 'y'
while restart=='y':
import random
user_name = input("What is yor name?\n")
#Write answers in a tuple.
answer=(
"Sure Thing",
"Why not",
"Siri Aproves",
"HaHa Nice!",
"Go for it",
"So Cool!",
"I'm Siri",
"Cool Story",
)
print ("Hi",user_name)
print ("Meet Siri.")
#get the users questions.
question= input ("Ask me for advice then press ENTER to shake me?\n")
print ("Shaking...\n"*4)
#Create a dice.
choice=random.randint(0,7)
#Print answer to the screen then restart
print (user_name,"You asked -",question)
print("Siri says:\n",answer[choice])
restart= input("\n\n Press y key to to play again\n")
Monday, 29 September 2014
SIRI Program
This is the code we used for Siri:
#Siri!!
#Restart
restart = 'y'
while restart=='y':
#Importing modules
import random
import time
#Get users name
user_name = input("\nWhat is yor name?\n")
#Write answers.
ans1= "Sure Thing"
ans2= "Why not"
ans3= "Siri Aproves"
ans4= "HaHa Nice!"
ans5= "Go for it"
ans6= "So Cool!"
ans7= "I'm Siri"
ans8= "Cool Story"
print ("Hi",user_name)
print ("Meet Siri.")
#Creates a random wait between shaking.
wait1=random.randint(1,8)
wait2=random.randint(1,8)
wait3=random.randint(1,8)
wait4=random.randint(1,8)
wait5=random.randint(1,8)
#get the users questions.
question= input ("Ask me for advice then press ENTER to shake me?\n")
#Shaking with a random wait time.
print ("Shaking...\n")
time.sleep(wait1)
print ("Shaking...\n")
time.sleep(wait2)
print ("Shaking...\n")
time.sleep(wait3)
print ("Shaking...\n")
time.sleep(wait4)
#Create a dice.
choice=random.randint(1,8)
if choice==1:
answer=ans1
elif choice==2:
answer=ans2
elif choice==3:
answer=ans3
elif choice==4:
answer=ans4
elif choice==5:
answer=ans5
elif choice==6:
answer=ans6
elif choice==7:
answer=ans7
else:
answer=ans8
#Print answer to the screen
print ("You asked -", question)
time.sleep(wait5)
print("Siri says -",answer)
restart= input("\n\n Enter y to to play again\n")
#Siri!!
#Restart
restart = 'y'
while restart=='y':
#Importing modules
import random
import time
#Get users name
user_name = input("\nWhat is yor name?\n")
#Write answers.
ans1= "Sure Thing"
ans2= "Why not"
ans3= "Siri Aproves"
ans4= "HaHa Nice!"
ans5= "Go for it"
ans6= "So Cool!"
ans7= "I'm Siri"
ans8= "Cool Story"
print ("Hi",user_name)
print ("Meet Siri.")
#Creates a random wait between shaking.
wait1=random.randint(1,8)
wait2=random.randint(1,8)
wait3=random.randint(1,8)
wait4=random.randint(1,8)
wait5=random.randint(1,8)
#get the users questions.
question= input ("Ask me for advice then press ENTER to shake me?\n")
#Shaking with a random wait time.
print ("Shaking...\n")
time.sleep(wait1)
print ("Shaking...\n")
time.sleep(wait2)
print ("Shaking...\n")
time.sleep(wait3)
print ("Shaking...\n")
time.sleep(wait4)
#Create a dice.
choice=random.randint(1,8)
if choice==1:
answer=ans1
elif choice==2:
answer=ans2
elif choice==3:
answer=ans3
elif choice==4:
answer=ans4
elif choice==5:
answer=ans5
elif choice==6:
answer=ans6
elif choice==7:
answer=ans7
else:
answer=ans8
#Print answer to the screen
print ("You asked -", question)
time.sleep(wait5)
print("Siri says -",answer)
restart= input("\n\n Enter y to to play again\n")
Wednesday, 17 September 2014
5 Times Table
This is how i made IDLE do the 5 times table:
number=5
while number<=100:
print(number)
number=number+5
Subscribe to:
Posts (Atom)
























