Friday, 30 October 2015

The Cashier Script

#1 Tell Python your prices:

Soup = 5.34
Paella = 6.32
Spaghetti = 5.37
Elf_cream = 60.00
Meat_balls = 8.45
Chicken_wings = 4.20
Elf_eyes = 7.00
Ice_cream = 3.73
Icy_tea = 2.80
Elf_nostrils = 10.20

#2 Print and wait 1 second and print and...

print ('What would you like to eat, sir/madam?')
print ('    ')

print ('We have:')
print ('First course:')
print ('    Soup, Paella, Spaghetti and Elf_cream')
print ('    ')


print ('Second course:')
print ('    Meat_balls, Chicken_wings and Elf_eyes')
print ('    ')


print ('Dessert:')
print ('    Ice_cream, Icy_tea, Elf_nostrils')
print ('    ')

print (' Type what you wish')
print ('for example: Soup + Meatballs + Icy_tea. Don/t forget the capital letter')
print ('    ')

print ('Hey, I forgot! Don/t forget to use *2 or *3 if you want more than one, example: Soup*3')
print ('Then click ENTER')
print ('    ')









14. TrollTalk

# 1. Computer says

print ('hello')


# 2. Computer says

print ('whatz yo name?')


# 3. Make yourself a Cola-Cao


# 4. Answer Name

NAME = input ()


# 5. Leave a line

print ('    ')


# 6. Computer says

print ('Nice to meet you, ' + NAME)


# 7. Leave a line

print ('    ')


# 8. Computer says

print ('Whatz yo favourite colour? ')


# 9. Answer Colour

COLOUR = input ()


# 10. Leave a line

print ('    ')


#11. Computer says

print (COLOUR + '? Are you sure? ' + NAME)

YESNO = input ()


#12. If the answer is yes or no or something different ...

if YESNO == ('yes'):

    print ('yes? yack, i hate ' + COLOUR)

elif YESNO == ('no'):

    print ('Not sure? Are you dumb or what?')

else:

    print ('i fink u stink')


#13. Leave a line

print ('    ')


#14 Question 1

print ('What is 5 + 99995?')

Q1 = input ()

if Q1 == ('100000'):

    print ('You Da Boss!!!!!')

else:

    print ('LOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOSER!!!!!!')


print ('    ')


#15 You continue it: Question 2

True or False (in the PyShell)

##We open Python. We work directly on the Shell (not IDLE). We are not going to save.
#Check out these symbols: <, >, <=, >=, ==, !=

THEY MEAN:
Smaller than: <
Bigger than: >
Smaller than or equal to <=
Bigger than or equal to >=
Equal to ==
Not equal to !=

#In the PyShell try some of these:

3<5, 5<3
6>5, 6>6
6<=5, 6<=6, 6<=7
8>=7, 8>=8, 8>=9
9==8, 9==9, 9==10
4!=3, 4!=4, 4!=5

The PyShell is clever, right?
Invent your own. Can you predict the answer?

Using the PyShell as a calculator.

#We open Python. We work directly on the Shell (not IDLE). We are not going to save.

# MATHEMATICS
#Adding. Try:
6+7
6+7+6
-1+-3

#Subtracting
7-6
6-7
-3--3

#Multiplying
6*7
45678*123456789
Try enormous numbers. How long does it take the computer to solve?

#Division
25/5
3/25

#MIXING operations
2+3*6/4-1

#Brackets
4+3*6
(4+3)*6
4+(3*6)

#These three last operations have the same numbers, yet they are two different algorithms.
Do you understand?

#Squared
4**2

#Cubic numbers etc
4**3
4**4

#Mixed Operations
7 (2*6)
7-(2*6)
-(7-(2*6)+1))
5+30*20/10

Try it all. Invent your own.

Thursday, 15 October 2015

pySHELL (doing) and IDLE Editor (making)

#When you click on the Python icon and the program launches, you are in the pyShell. So as to say it you are working Live.

#But if you want to create a program you will need a Code Editor. I use IDLE. IDLE  is like a sheet of paper where you will type your scripts.

#So,

#1.
·Open Python
·File > Save
·NAME: 01 HelloWorld.py
·Save in your folder, in a subfolder called Python Scripts
·Close Python

#2.
·Go to your folder. Find 01 HelloWorld.py.
Is it there?
·This is how I open it:
Right-Click on 01.HelloWorld.py > Edit with IDLE
This is where you are going to create your scripts.
·You are ready to programme.

#3.
·Type
print ('Hello World')
·Click F5
·Say yes to Save
·The PythonShell opens. The command written on IDLE has been executed in the SHELL

#4 Reposition your two windows like in the photo. IDLE on the left, Python Shell on the right.

#5.
This is your first script in Python

Python

Install https://www.python.org/downloads/
Idlex http://idlex.sourceforge.net/
Tablet qPython (Android)