Friday, 29 April 2016

37. Questionnaire Extended (Name, Class Date, Activity Code)

#Participant data:

print ('Whats your name?')
NAME = input()
print ()
print (NAME + ', which is your class?')
CLASS = input ()
print ()

#Questionaire CODE
print ('ASK YOUR TEACHER FOR THE QUESTIONNAIRE CODE')
CODE = input()
print()

#Scores are set to 0
a=0
b=0
TOTAL = a+b

#Q1
print("Q1: Which is ...  ")

Q1 = ''
Q1 = input()

if Q1 ==("yes"):
    print ('correct')
    TOTAL = TOTAL + 1
elif Q1 ==("butt"):
    print ("10 extra points")
    TOTAL = TOTAL + 10
else:
    print ('incorrect')
    TOTAL = TOTAL - 1
print ('your points are ?...')
print (TOTAL)

#Q2
print("Q2: Why did ... ")

Q2 = ''
Q2 = input()

if Q2 ==("yes"):
    print ('correct')
    TOTAL = TOTAL + 1

elif Q2 ==("butt"):
    print ("10 extra points")
    TOTAL = TOTAL + 10
else:
    print ('incorrect')
    TOTAL = TOTAL - 1
print ('your points are ?...')
print (TOTAL)

#Q3 Copy and paste #1 and modify

#SCORES and DATE

import time
localtime = time.asctime( time.localtime(time.time()) )

print()
print ('****************** SHOW THIS TO TEACHER TO CHECK ***************')
print ('Name: ' + NAME)
print ('Class: '+ CLASS)
print ('Total Points: ... '), print(TOTAL)
print ('Activity CODE: ' + CODE)
print ('Today is: ' + localtime)

36. Questionnaire


#Q1
print("Q1: x  ")

Q1 = ''
Q1 = input()

if Q1 ==("yes"):
    print ('correct')
    TOTAL = TOTAL + 1
elif Q1 ==("butt"):
    print ("10 extra points")
    TOTAL = TOTAL + 10
else:
    print ('incorrect')
    TOTAL = TOTAL - 1
print ('your points are ?...')
print (TOTAL)

#Q2
print("Q2:  ")

Q2 = ''
Q2 = input()

if Q2 ==("yes"):
    print ('correct')
    TOTAL = TOTAL + 1

elif Q2 ==("butt"):
    print ("10 extra points")
    TOTAL = TOTAL + 10
else:
    print ('incorrect')
    TOTAL = TOTAL - 1
print ('your points are ?...')
print (TOTAL)


35. pre-Cognition (Expanded)

#Pre-cognition

# Import the modules
import random

a=0
b=0

while True:
    print ('')
    print ('Think of a number from 1 to 9  ##########################')
    ANS = int(input())
    answers = random.randint(1,9)

    if ANS == answers:
        a=a+1
       
    elif ANS != answers:
        b=b+1

    print (' aleatorial bot says: ')
    print(answers)    
    print ('')
    print ('ATTEMPTS /20 : ')
    TOTAL = a+b
    print (TOTAL)
    print ('')
    print ('YES:')
    print (a)
    print ('NO:')
    print (b)
    print ('')
   
TOTAL = a+b
    YOURSCORE = (a/TOTAL)*100
    print('YOUR SCORE as % is :')
    print (YOURSCORE)

    if YOURSCORE <=11.11:
        print ('Pre-Cognition level = 0/9')
    elif 11.11 < YOURSCORE <=22.22:
        print ('Pre-Cognition level = 1/9')
    elif 22.22 < YOURSCORE <=33.33:
        print ('Pre-Cognition level = 2/9')
    elif 33.33 < YOURSCORE <=44.44:
        print ('Pre-Cognition level = 3/9')
    elif 44.44 < YOURSCORE <=55.55:
        print ('Pre-Cognition level = 4/9')
    elif 55.55 < YOURSCORE <=66.66:
        print ('Pre-Cognition level = 5/9')
    elif 66.66 < YOURSCORE <=77.77:
        print ('Pre-Cognition level = 6/9')
    elif 77.77 < YOURSCORE <=88.88:
        print ('Pre-Cognition level = 7/9')
    elif 88.88 < YOURSCORE <=99.99:
        print ('Pre-Cognition level = 8/9')      
    elif YOURSCORE ==100:
        print ('Pre-Cognition level = 9/9. Perfection')

    if TOTAL == 20:
        print ('thank you')
        break

34. pre-Cognition

#Pre-cognition

# Import the modules
import random

a=0
b=0

while True:
    print ('Think of a number from 1 to 9')
    ANS = int(input())
    answers = random.randint(1,9)

    if ANS == answers:
        a=a+1
       
    elif ANS != answers:
        b=b+1

    print (answers)    
    print ('')
    print ('YES:')
    print (a)
    print ('NO:')
    print (b)
    print ('')

33. Fibonacci



#fibonacci

a=1
print (a)
b=2
print (b)

for x in range(1, 100):
    b=b+a
    print (b)
    a=b-a

import webbrowser
webbrowser.open('https://en.wikipedia.org/wiki/Fibonacci_number')

2.1 pyShell Playing with Letters

#In the shell type
'hello' + 'ugly'
#Click Enter

#Now try these (words with + and *)
'hello  ' + 'ugly'
 hello + ugly
'abc' * 3
'abc' * 1000
'abc' * 'abc'

#Understanding: print (say/type)
print (' i am happy')
print (hello)
print (42)

mysecret = 'i love shakira! '
print mysecret
print mysecret * 100

note: page 61 hacking cyphers







Sunday, 13 March 2016

playpythonpy

playpythonpy

Thursday, 4 February 2016

Count For Me. with intervals



#count for me
numbers = range(0,288,10)
for count in numbers:
     print (count)

     #changing the numbers?
     #adding three inputz?

Creating a .py file




#Let´s repeat previous lesson. We are going to create a Python document call test.py. We will use it for experimenting.

#Open Python
#File > New > Save > test.py
#Close Python
#Find test.py > right click > IDLE Editor
#Try it out, copy this.

a = 7
print (a)


#Click F5
#Say Yes to Save
#Position the two windows comfortably (IDLE on left, the Shell on right)
 

#Done! You are now ready for more challenging stuff.

While

#Playing with while

#while 1
a=0
while a<1:
   print ('.............................................')

#while 2
a=1
while a <1000:
    a=a+1
    print (a)

#while3
a=1
while a <1000:
    a=a-1
    print (a)

If



#In this script we are going to ask a closed question (three options of answer). The user with read the question and answer. Depending on the answer, the script will reply with a specific comment. 

print ('Do you believe in God?')
a = input ( )

if a == ('yes'):
    print ('You are a believer')
elif a == ('no'):
    print ('You are either an agnostic or an atheist')
else:
    print ('No wanna talk with me? Bye!')

input ( )



#Input 1. Copy and paste these 3 lines. Then click F5.
print ('Whatz your name')
a = input ( )
print (a)

#Input 2. Try these 3.
print ('Whatz your name')
a = input ( )
print ('Nice to meet you, ' + a)


#Input 3. More:
print ('Whatz your name')
a = input ( )
print ('Nice to meet you, ' + a)
print ('How old are you')
b = input ( )
print ('So, you are ' + a + ' and you are ' + b + ' years old')


#Input 4. Your turn

Variables



#Open test.py (previous lesson).
Remember: right-click > open with IDLE
You are going to use it for testing little snippets of code.

# Variables 1: Copy and paste the following two lines. Then click F5.
a = 7
print (a)

What is happening?

# Variables 2: Delete the previous. Try these three now. Then click F5.
a = 9
b =a
print (b)

# Variables 3: What is happening? Now a longer one.
a = 9
b = a
c = b
d = c
e = d
print (d)

#Variables 4: With input (varying answers)
print ('You favourite word')
a = input ( )
print ('Your favourite word is ' + a)

What is happening?

#Variables 5: With 2 different inputs:
print ('You favourite word')
a = input ( )
print ('You favourite number')
b = input ( )
print ('So you like ' + a + b)

#Variable 6: Your turn. Create more!


Squared iii (with input)

print ('Choose a number for me to square')

a = int(input ())

while a < 10000000000000000000000000000000000000000000000000000:

    a = a * a

    print (a)

Wednesday, 3 February 2016

Monday, 1 February 2016


















































Comecocos

a=0
while a<1:
    print ('A number from 1 to 6')
    print ('')
    guess = int(input())

    if guess  == 1:
        print('Tidy up your bedroom')
        print ('')

    elif guess == 2:
        print('Help with the laundry')
        print ('')

    elif guess == 3:
        print('Call your best friend')
        print ('')
     

    elif guess == 4:
        print('Write a poem')
        print ('')

    elif guess == 5:
        print('Don´t think for 2 minutes')
        print ('')
       
    elif guess == 6:
        print('Dance crazily for 2 minutes')
        print ('')

    else: print ('That is not a valid number, you poo!!!!')











































































Guess The Number



# This is a guess the number game.

import random
secretNumber = random.randint(1, 20)
print('I am thinking of a number between 1 and 20. You have 6 chances')

# Ask the player to guess 6 times.
for guessesTaken in range(1, 7):
    print('Take a guess.')
    guess = int(input())
    if guess < secretNumber:
        print('Your guess is too low.')
    elif guess > secretNumber:
        print('Your guess is too high.')
    else:
        break # This condition is the correct guess!


if guess == secretNumber:
    print('Good job! You guessed my number in ' + str(guessesTaken) + ' guesses!')
else:
    print('Nope. The number I was thinking of was ' + str(secretNumber))

Which Numbers Between

#WhichNumbersBetween
a=int(input("Starting Number"))
b=int(input ("Finishing Number"))
for i in range (a , b):
    print (i)    #python

Add Numbers to 100

#AddNumbersTo100
total = 0
for num in range (101):
      total = total + num                       
      print (total) #python

How Fast Can You Count

#HowFastCanYouCount
a = 1
while a > 0:
    a = a+1
    print (a)    #python

James Bond Password (Extended)



a = ' '
while a != 'JamesBond':
    print ('username')
    a = input ( )

b = ' '
while b != '007':
    print ('password')
    b = input ( )

print ('Welcome to MI6')



James Bond Password



a = '   '

while a != '007':
    print ('password')
    a = input ()
print ('Welcome to M16')

Thursday, 21 January 2016



















































































































13 Comecocos (aleatorial)



# 13 COMECOCOS (aleatorial)

import random
a=0
while a<1:
    print ('A number from 1 to 7')
    print ('')
    answerNumber = input()
    def getAnswer(answerNumber):
        if answerNumber  == 1:
            return('Tidy up your bedroom')
         
        elif answerNumber == 2:
            return('Help with the laundry')
         
        elif answerNumber == 3:
            return('Call your best friend')         
   
        elif answerNumber == 4:
            return('Write a poem')       

        elif answerNumber == 5:
            return('Don´t think for 2 minutes')
             
        elif answerNumber  == 6:
            return ('Dance crazily for 2 minutes')
         
        else:
             print ('That is not a valid number, you poo!!!!')
    r= random.randint (1,7)
    fortune = getAnswer(r)
    print (fortune)
    print ('')

Thursday, 14 January 2016

20 Squared II

a = 2
while a > 0:
    a = a * a
    print (a)

#Change the 2, and compare

Tuesday, 12 January 2016

24 My Tables III (ad infinitum)

#Multiplication tables
#With input
#Non stop

a = int(input("Enter a number: "))
b = a

a = 0
while a > -1:
    a = a + int(b)
    print (a)

17 What´s this?

count = 1
while (count > 0):
    count = count * 10
    print(count)

























































Monday, 11 January 2016

17 Can a bot be aleatorial?

# Import the modules
import sys
import random
import time

print ('Can a bot be aleatorial?')

ans = True

while ans:
   
    answers = random.randint(1,9)
   
    if answers == 0:
        sys.exit()
   
    elif answers == 1:
        print ('1')
        time.sleep(1)
   
    elif answers == 2:
        print ('2')
        time.sleep(1)
   
    elif answers == 3:
        print ("3")
        time.sleep(1)

    elif answers == 4:
        print ("4")
        time.sleep(1)
       
    elif answers == 5:
        print ("5")
        time.sleep(1)
   
    elif answers == 6:
        print ("6")
        time.sleep(1)
       
    elif answers == 7:
        print ("7")
        time.sleep(1)
       
    elif answers == 8:
        print ("8")
        time.sleep(1)
       
    elif answers == 0:
        print ("0")
        time.sleep(1)
       
    elif answers == 8:
        print ("8")
        time.sleep(1)
       
    elif answers == 9:
        print ("9")
        time.sleep(1)
       

16. While

count = 0
while (count < 9):
   print ('I repeat this'), count
   count = count + 1

print ('"Good bye!')

15 The Cashier script (with time.sleep)

#1 Let´s import a toy that we will use later
import time

#2 Print and wait 1 second and print and...
print ('What would you like to eat, sir/madam?')
print ('    ')
time.sleep(2)

print ('We have:')
time.sleep(2)

print ('First course:')
print ('    Soup, paella, spaghetti and elf_cream')
print ('    ')
time.sleep(4)

print ('Second course:')
print ('    Meat_balls, Chicken_wings and elf_eyes')
print ('    ')
time.sleep(4)

print ('Dessert:')
print ('    Ice_cream, icy_tea, elf_nostrils')
print ('    ')
time.sleep(4)

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

print ('Then click ENTER')


#3 Now 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

16 time.sleep

import time
print ('hello')
time.sleep(5)
print ('bye')

2squared



a = 2
while a < 10000000000000000000000000000000000000000000000000000:
    a = a * a
    print (a)

#Change the 2, and compare

27. Count the letters

print ('Copy and paste a text here:')
text = input ()

a = 0
while a < 10:

    print ('Choose the letter of letter group you want to count')
    letter = input ()

    a =  text.count(letter)
    print (a)

13. Count for me

numbers = range(1,288)
for count in numbers:
     print (count)