Python Cheat game

Hello guys, I’ve created a terminal game in Python. Which is called the ‘Cheat game’. With few questions could easily tell if you’re a cheat or not. And well, there are even surprises too.

Kindly visit download and try it out.

Have you found any bugs or wants to improve it? Let’s get interactive shall we?

Twitter: @dsvl_life

Instagram: @dawncode84

Snapchat: @dawndavid

Whatsapp group invite:

Thank you.

Dealing with parameters in Python

# Parameters, Unpacking, Variables
# We will cover one more input type in here Dawn
# You can use to pass variables to a script (script being another name for # Your .py files)
# The part of the command is called an “argument”
# What we’ll do now is write a script that also accepts accepts arguments

from sys import argv

script, Dawn, Lin, Collins = argv

print “The script is called:”, script
print “Your first variable is:”, Dawn
print “Your second variable is:”, Lin
print “Your third variable is:”, Collins

print “\nWho are you?”
name = raw_input()

print “\nWhats your mission?”
purpose = raw_input()

print “\nWho is your prime target?”
entity = raw_input()

print “\nSo you are %s and your mission is to %s. And well prime target is %s” % (name, purpose, entity)

print “\nReally?”
answer = raw_input()

Input type 2

# Prompting People
# We are using more of the raw_inputs
# Asking normal question you know πŸ™‚

age = raw_input(“How old are you? “)
height = raw_input(“How tall are you? “)
weight = raw_input (“How much do you weigh? “)

print “So, you’re %r old, %r tall and %r heavy.” % (age, height, weight)

Taking inputs

# Now its time to pick up the pace.
# Lets do some ‘real’ software thing
# All along we have been printing
# We haven’t taken in any inputs talk less of changing it
# Don’t worry pal, we are in line πŸ™‚
# You should go online to find out what python ‘raw_input’ does πŸ™‚

print “How old are you?”,
age = raw_input ()

print “How tall are you?”,
height = raw_input()

print “How much do you weigh?”,
weight = raw_input()

print “So, you’re %r old, %r tall and %r heavy.” % (age, height, weight)

Doing more with backslash

# Doing more with backslash \ and ‘n’
# They are called escape keys too
# Some other time we would search online to find out what other
# Escape sequences we have

print “I am 6’2\” tall.” # Escape double-quote inside string
print ‘I am 6\’2″ tall.’ # Escape single-quote inside string

tabby_cat = “\tI’m tabbed in.”
persian_cat = “I’m split\non a line.”
backslash_cat = “I’m \\ a \\ cat.”

fat_cat = “””
I’ll do a list:
\t* Cat food
\t* Fishes
\t* Catnip\n\t* Grass

single_quotes = ”’
We we’re using thripple single quotes
“How would it fair down here”
Down here
black_node = “Dawn”
code = “White”
number = 200

print “%r Dawn” % ‘Hi’

print “Dawn says his next code name would be %s” % ‘white_frog’
print single_quotes
print tabby_cat
print persian_cat
print backslash_cat
print fat_cat
print “He is %s, loves %s and would live for a %d yrs” % (black_node, code, number)

Discovering yourself.

β€œI sometimes feel like we collect different versions of ourselves β€” and in an effort to fit amongst a particular crowd we pull one of those selves from the pack, like a magician mid-card trick.” Flora at Flora the Explorer contemplates her blogging and social mediaΒ presence.

via Who Are You Online? (My Travel Writing Reality) β€” Discover

More works on Variables

# More printing, printing, printing
# We are adding something new you know
# Here’s some new strange stuff, we’re typing it exactly
# If you really want to write much, use 3 double quotes “””

days = “Mon Tue Wed Thu Fri Sat Sun”
months = “\n\t\nJan\n\tFeb\n\t\fMar\n\tApr\n\t\tMay\n\t\nJun\n\tJul\n\t\vAugust\b\n\aSep” # The use of ‘\n’ brings the word to the second line. As in an enter been pressed.

print “\nHere are the days: “, days
print “\tHere are the months:”, months

print “””
There’s something going on here.
With the three double-quotes.
We’ll be able to type as much as we like.
And that is a good news

Python Test 8. More use of Variables

# More printing
# Always look intently with an Eagle eye.


formatter = “%r %r %r %r”

print formatter % (1, 2, 3, 4)
print formatter % (“one”, “two”, “three”, “four”)
print formatter % (True, False, False, True)
print formatter % (formatter, formatter, formatter, formatter)
print formatter % (
“I had this thing.”,
“That you could type up right.”,
“But it didn’t sing.”, # It appears as it is because of (‘) in the sentence
“So I said goodnight.”

This is an extra. Building from

# We are building from the knowledge gained from
# The use of the format characters and strings which are for the time been d, s and r.
# Previously we used pounds and inches
# In here, we would write variables that converts inches to centimeters
# Pounds to kilo

inches = ‘1 cm’
pounds = ’10 kilo’
cm = ‘1 m’
size = 25000
land = ‘acres of land’
kilometers = ‘1000 m’
code = ‘Dawn’
black_node = ‘Darkest Black Hat’
white_frog = ‘Cobra7’

print “%s has %d %s and still counting” % (code, size, land)
print “So %s is very cool.” % code # If the format character %s is used, it can work with all sentences
print “Mathematically, 10 inches make”, inches # If there is no % sign, use (,) comma instead
print “So also 100 pounds make”, pounds # You can’t use both % and , sign all together. You need only one of them
print “And then 100 cm makes”, cm # Either you use the (,) comma symbol then the variable or the % and the variable
print “Lastly if we could remember 100 kilometers makes”, kilometers
print “%r impulse would not be a bad idea” % black_node # ‘Darkest Black Hat’ is in single quotes when printed?
print “Just maybe %r would be our next code name :)-” % white_frog # Notice this one too has quotes around it?

# Whenever the format character %r is used, it brings a single quote around the partnered variable
# As in Darkest Black Hat and Cobra7
# Remember that anytime you use the %d format character, it should have a number as a partner
# Anytime you use the %d format character, you know obviously that you are going to use a number right?
# When using the numbers with %d, do not put them in quotes
# Whether single or double

Extra Variables

# This is an update on variables used in
# In here, we are going to use some variables in a form of letters
# To do some calculations
# As you know, you must equate your variable to something. It should ve a partner πŸ™‚

a = 4
j = 2
q = 1
i = 8

print “a + j” # This does not print out the required result 😦 ‘6’
print “i + q” # Instead, it prints out i + q
print “j + q” # It prints out the letters as they are on the screen 😦
print “a + i” # That is not the target, let’s try something else,

print a + j # Ok, so this one works πŸ™‚
print i + q # When using 2 partnering variables raw, don’t add any quotes
print j + q # To it. If quotes are added, they wont be printed as a ‘variable’
print a + i # Defined earlier on but rather as they are on the screen
print a / q
print q * i
print a + q / i
print i / q – a

More printing

# More printing

print “Mary had a little lamb.”
print “It’s fleece was white as %s.” % ‘snow’ # The ‘snow’ used here is a variable.
# Its kind of new though πŸ™‚
# Notice that this variable is in a quote?
# It’s because it hasn’t been defined earlier
# But later in the sentence
print “And every where that Mary went.”
print “.” * 10 # what’d that do? It will print ‘.’ 10x

end1 = “C”
end2 = “h”
end3 = “e”
end4 = “e”
end5 = “s”
end6 = “e”
end7 = “B”
end8 = “u”
end9 = “r”
end10 = “g”
end11 = “e”
end12 = “r”

# watch that comma at the end. Try removing it to see what happens
print end1 + end2 + end3 + end4 + end5 + end6,
print end7 + end8 + end10 + end11 + end12