Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 6

Logic Puzzle : Knight and knave

NOT EVEN CLICKBAIT


Help the channel grow with a Like, Comment, & Subscribe!
❤️ Support ➡ https://j-h.io/patreon ↔ https://j-h.io/paypal ↔
https://j-h.io/buymeacoffee
Check out the affiliates below for more free or discounted learning!
🖥 ️ Zero-Point Security ➡ Certified Red Team Operator https://j-h.io/crto
💻Zero-Point Security ➡ C2 Development with C# https://j-h.io/c2dev
🐜Zero2Automated ➡ Ultimate Malware Reverse Engineering https://j-h.io/zero2auto
🐜Zero2Automated ➡ MISP & Malware Sandbox https://j-h.io/zero2auto-sandbox
⛳Point3 ESCALATE ➡ Top-Notch Capture the Flag Training https://j-h.io/escalate
👨🏻‍💻 7 a S ecurity ➡ Hacking Courses & Pentesting https://j-h.io/7asecurity
📗Humble Bundle ➡ https://j-h.io/humblebundle
🐶Snyk ➡ https://j-h.io/snyk
‍♀️ SkillShare 🤹‍️➡https://j-h.io/skillshare

🌎Follow me! ➡ https://j-h.io/discord ↔ https://j-h.io/twitter ↔


https://j-h.io/linkedin ↔ https://j-h.io/instagram ↔ https://j-h.io/tiktok

📧Contact me! (I may be very slow to respond or completely unable to)


🤝Sponsorship Inquiries ➡ https://j-h.io/sponsorship
🚩 CTF Hosting Requests ➡ https://j-h.io/ctf
🎤 Speaking Requests ➡ https://j-h.io/speaking
💥 Malware Submission ➡ https://j-h.io/malware
❓ Everything Else ➡ https://j-h.io/etc

prompt = "\nEnter 'quit' when you are finished."


prompt += "\nPlease enter your age: "

while True:
age = input(prompt)
age = int(age)

if age == 'quit':
break
elif age <= 3:
print("Your ticket is free")
elif age <= 10:
print("Your ticket is $10")
else:
print("Your ticket is $15")

x = raw_input('Enter a number: ')


for i in range(1,12):
print int(x)*i

person_name = input()
person_age = int(input())
num1 = int(input())
num2 = int(input())
num3 = num1+num2
print(num3)

Numerology calculator in Python


This script calculates your numerology profile based on the book by Camila
Karolinss, a Czech numerologist.

To use it:
Run the script and enter your name and surname. If you have a middle name, write it
together with the name, such as "HansAdam".
Read the numbers and check in the above mentioned book, what it means.
You can use Czech diacritics in the name, but the calculation also works without
it. If you have any strange characters in your name, that are unknown to Czech
alphabet, do not use the diacritics, or the script will fail.
To do:
Write an interpreter that will provide information about someone's characteristics,
based on the definitions in the book.
Provide an English translation of the strings.
Disclaimer:
The strings are written in Czech.
Numerology is considered unconfirmed. I take no responsibility for any analysis you
will get from this script now and any time in the future.

#!/usr/bin/python3

class Person:
def __init__(self, name, surname):
self.name = name
self.surname = surname
self.calcTable = {'A':1,'Á':1, 'J':1, 'S':1,'Š':1, 'B':2, 'K':2, 'T':2,
'Ť':2,'C':3, 'Č':3, 'L':3, 'U':3, 'Ú':3, 'Ů':3, 'D':4, 'Ď':4, 'M':4, 'V':4,'E':5,
'É':5, 'Ě':5,
'N':5,'Ň':5, 'W':5,'Ö':5, 'F':6, 'O':6,'Ó':6,
'X':6,'G':7, 'P':7, 'Y':7, 'Ý':7,'H':8, 'Q':8, 'Z':8,'Ž':8,'I':9,'Í':9, 'Ü':9,
'R':9, 'Ř':9}
self.risks = [7, 16, 25, 34, 52, 61, 70, 79, 88, 92]
self.highrisks = [29, 40, 43]
self.problematic = 0

def gcalc(self, word):


"""Calculate the gross number from the word."""
word = list(word)
total = 0
for letter in word:
value = self.calcTable[letter]
total = total + value
return(total)

def reduce(self, number):


"""Reduce gross numbers to netto numbers."""
if number == 11 or number == 22: # Numbers 11 or 22 should not be reduced.
total = number
else:
total = number
size = len(str(total))
if size > 1:
while size > 1: # Repeats until the number is not fully reduced to
one digit only.
if total == 11 or total == 22: #Numbers 11 or 22 should not be
reduced.
break
word = str(total)
word = list(word)
total = 0
for letter in word:
total = total +int(letter)
size = len(str(total))

else:
total = number
return(total)

def ncalc(self, word):


"""Calculate the netto numbers."""
word = list(word)
total = self.gcalc(word)
total = self.reduce(total)
return(total)

def getInNum(self):
"""Return the numeric value of the first letter in a name."""
nletter = list(self.name)
nletter = nletter[0]
total = self.calcTable[nletter]
return(total)

def getIsNum(self):
"""Return the numeric values of the first letter in a surname."""
sletter = list(self.surname)
sletter = sletter[0]
total = self.calcTable[sletter]
return(total)

def getWest(self):
"""Return the number for the western part of cross."""
west = self.ncalc(self.name)
west = self.reduce(west)
return(west)

def getEast(self):
"""Return the number for the eastern part of cross."""
east = self.ncalc(self.surname)
east = self.reduce(east)
return(east)

def getSubNorth(self):
subnorth = self.getInNum()+self.getIsNum()
return(subnorth)

def getNorth(self):
"""Return the personal number."""
north = self.getSubNorth()
north = self.reduce(north)
return(north)

def getFirst(self):
"""Return the number of the first life trimester."""
first = self.gcalc(self.name) + self.gcalc(self.surname)
return(first)
def getSecond(self):
"""Return the number of the second life trimester."""
second = self.getNorth() + self.getFirst()
return(second)

def getThird(self):
"""Return the number of the third life trimester."""
third = (self.gcalc(self.name)+self.getSubNorth()) +
(self.gcalc(self.surname)+self.getSubNorth())
return(third)

def getSouth(self):
"""Return the number in the southern part of cross."""
south = self.reduce(self.getThird())
return(south)

def calcCross(self):
"""Return the values of the horizontal and vertical additions on the
cross."""
horizontal = self.getWest()+self.getEast()
vertical = self.getNorth()+self.getSouth()
middle = horizontal + vertical
return(horizontal,vertical,middle)

def getLowest(self):
number = self.getThird()
size = len(str(number))
if size > 1:
number = list(str(number))
total = 0
for num in number:
total = total + int(num)
else:
total = number
return(total)

def getRisk(self,number):
"""Find out whether a number is a risk number."""
if number in self.risks:
risk = '!'
elif number in self.highrisks:
risk = 'X'
else:
risk = ''
return(risk)

def getFlow(self, number):


"""Find out whether there is an energy leak."""
if number == 8:
flow = 'EF'
elif number%8 == 0:
flow = 'PEF'
else:
flow = ''
return(flow)

class PrintCross:
"""Print out all values in the cross (no background though)."""
def __init__(self, person):
self.person = person

def printCross(self):
print(' {}
'.format(self.person.getNorth()))
print(' ')
print(' {} {}
'.format(self.person.getInNum(), self.person.getIsNum()))
print(' ')
print('{}
{}'.format(self.person.getWest(), self.person.getEast()))
print(' {}
'.format(self.person.getFirst()))
print(' ')
print(' {} {} {}
'.format(self.person.gcalc(name), self.person.getSecond(),
self.person.gcalc(surname)))
print(' ')
print(' {}
'.format(self.person.getThird()))
print(' ')
print(' {} {}
'.format((self.person.gcalc(name)+self.person.getNorth()),
(self.person.gcalc(surname)+self.person.getNorth())))
print(' {}
'.format(self.person.getLowest()))
print(' ')
print(' {}
'.format(self.person.getSouth()))

class PrintNums:
def __init__(self, person):
self.person = person

def printNums(self):
print("Výpočet pro jméno:",self.person.name, self.person.surname)
print("=============================================================")
print("Hrubé číslo jména:", self.person.gcalc(name),
self.person.getRisk(self.person.gcalc(name)))
print("Hrubé číslo příjmení:", self.person.gcalc(surname),
self.person.getRisk(self.person.gcalc(surname)))
print("-------------------------------------------------------------")
print("Západ:", self.person.getWest(),
self.person.getRisk(self.person.getWest()))
print("Východ:", self.person.getEast(),
self.person.getRisk(self.person.getEast()))
print("Sever:", self.person.getNorth(),
self.person.getRisk(self.person.getNorth()))
print("Jih:", self.person.getSouth(),
self.person.getRisk(self.person.getSouth()))
print("-------------------------------------------------------------")
print("Číslo iniciály jména: ", self.person.getInNum(),
self.person.getRisk(self.person.getInNum()))
print("Číslo iniciály příjmení: ", self.person.getIsNum(),
self.person.getRisk(self.person.getIsNum()))
print("Číslo osobnosti:
",self.person.getSubNorth(),self.person.getRisk(self.person.getSubNorth()))
print("-------------------------------------------------------------")
print("Číslo první fáze života: ", self.person.getFirst(),
self.person.getRisk(self.person.getFirst()))
print("Číslo druhé fáze života: ", self.person.getSecond(),
self.person.getRisk(self.person.getSecond()))
print("Číslo třetí fáze života: ", self.person.getThird(),
self.person.getRisk(self.person.getThird()))
print("Pomocné číslo je: ", self.person.getLowest(),
self.person.getRisk(self.person.getLowest()))
print("-------------------------------------------------------------")
kname = self.person.gcalc(name)+self.person.getSubNorth()
ksurname = (self.person.gcalc(surname)+self.person.getSubNorth())
print("Číslo kombinace jména a osobnosti (vlevo dole):", kname,
self.person.getRisk(kname))
print("Číslo kombinace příjmení a osobnosti (vpravo dole):", ksurname,
self.person.getRisk(ksurname))
print("-------------------------------------------------------------")
hor, ver, sum = self.person.calcCross()
print("Horizontální výpočet kříže: ", hor, self.person.getRisk(hor),
self.person.getFlow(hor))
print("Vertikální výpočet kříže: ", ver, self.person.getRisk(ver),
self.person.getFlow(ver))
print("Součet kříže: ", sum, self.person.getRisk(sum),
self.person.getFlow(sum))
print("=============================================================")

incoming = input("Zadejte vaše jméno a příjmení (Jan Novák): ")


incoming = incoming.upper()
incoming = incoming.split(" ")

name = incoming[0]
surname = incoming[1]

person = Person(name, surname)


calculation = PrintNums(person)
calculation.printNums()

choice = input("Chcete zobrazit kříž pro toto jméno? (a/n): ")


choice = choice.upper()
if choice == 'A':
cross = PrintCross(person)
cross.printCross()
else:
pass

You might also like