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