I've been programming a little text based hacking game, my code will be below.
#SICCr4k2: Broke
#
#
#
#Remember whenever you are printing a random ip address to add the "." in between each part of the ip (each random number)
## LAST LEFT ON HERE: MAKE BUTTONS FOR NODES
## MAKE FILES FOR NULL'S NODE
## SET THE CORRECT PLACEMENTS FOR ALL THE BUTTONS
## nullMain referenced before assignment
## make it so that you send a message through the prompt to get their ip, then it automatically puts the ip in the nodes
## window. Like you send the person a message, and then it gets the ip and puts it in the nodes window
## take away the buttons in the nodes window, just at labels where it points to the host's ip address.
## Don't use tkinter buttons anymore
## Regular Campaign, separate program for free roam hacking
## At the end, make it so Null betrayed you and you have to destroy his computer, destroy him.
import random
import time
import sys
import os
import tkinter as tk
from tkinter import *
#def nodes():
# nodeWindow = tk.Tk()
# frame = tk.Frame(nodeWindow, width=700, height=400)
# frame.grid_propagate(0)
# frame.grid()
# nodeWindow.title("||| Nodes |||")
# nodeWindow.iconbitmap(r'C:\Users\John\Desktop\Programming\SICCr4k2BrokeFold\BrokeItems\NodeIcon.ico')
# nodeWindow.wm_resizable(0,0);
# nullMain = tk.Button(nodeWindow, text="Null", function=nullMainCallback())
# nullMain.config(height=1, width=100)
# nullMain.grid(row=0, column=0)
# def nullIpBackCallBack():
# nullMain = tk.Button(nodeWindow, text="Null", function=nullMainCallback())
# nullMain.config(height=1, width=100)
# nullMain.grid(row=0, column=0)
# def nullMainCallback():
# nullMain.destroy()
# nullIp = tk.Label(nodeWindow, text="Ip: 221.153.52.216")
# nullIp.grid(row=0, column=0)
# nullIpBack = tk.Button(nodeWindow, text="Back", function=nullIpBackCallBack())
# nullIpBack.grid(row=1, column=0)
sys.setrecursionlimit(99999)
def nodes1():
nullIp = ('18.226.109')
print('||| Nodes ||||')
print(' ')
print('Null')
print('')
nodeInput1 = input('>>> ')
if nodeInput1 == ('null') or ('Null'):
print("Null's ip: " + nullIp + " <<<back")
def connecting():
#TRY TO MAKE 'CONNECTING' CENTERED
time.sleep(1)
print('Connecting')
time.sleep(1)
os.system('cls')
print('Connecting.')
time.sleep(1)
os.system('cls')
print('Connecting..')
time.sleep(1)
os.system('cls')
print('Connecting...')
time.sleep(1)
os.system('cls')
print('Connecting')
time.sleep(1)
os.system('cls')
print('Connecting.')
time.sleep(1)
os.system('cls')
print('Connecting..')
time.sleep(1)
os.system('cls')
print('Connecting...')
time.sleep(1)
os.system('cls')
print('Connecting')
time.sleep(1)
os.system('cls')
print('Connecting.')
time.sleep(1)
os.system('cls')
print('Connecting..')
time.sleep(1)
os.system('cls')
print('Connecting...')
time.sleep(1)
os.system('cls')
print('You are now connected.')
def connectNull_Tutorial():
#MAKE EVERYTHING CENTERED WELL
numbers()
time.sleep(2)
os.system('cls')
connecting()
print('You now have access to (comp ID): Null')
time.sleep(2)
os.system('cls')
print('Type what you want access to:')
print('Files | Options | Mainframe')
time.sleep(2)
def nullFiles_Tutorial():
print('Go ahead and type Files.')
input('>>> ')
if ('files') or ('Files'):
print('Files:')
print('Key: (T)Text file | (E)Executable | (F)Folder')
print('')
print('')
print('')
print("""screenNames.T""")
time.sleep(2)
def screenNames_Tutorial():
print('Now type in screenNames.T, exactly as it is.')
input('>>> ')
if ('screenNames.T'):
print('|screenNames.T|')
print('')
print('ras1aB, p0Nk, killT0n, raspberryH4cker, 314dk0m')
print('h4ckB3rr13s, b3y0ndPyth0n, j03Dr4n, jitsl3d, 01f0r4')
time.sleep(2)
print('These names...')
time.sleep(2)
print('These people, they need to be dealt with.')
time.sleep(2)
print("It's time to start making this world a better place.")
print("Remember getIp()? Put it to good use with these names")
else:
screenNames_Tutorial()
screenNames_Tutorial()
else:
nullFiles_Tutorial()
nullFiles_Tutorial()
def numbers():
def numbersCode():
t_end = time.time() + 5
while time.time() < t_end:
number1 = random.randint(100, 999)
number2 = random.randint(100, 999)
number3 = random.randint(100, 999)
number4 = random.randint(100, 999)
print(str(number1) + ' ' + str(number2) + ' ' + str(number3) + ' ' + str(number4) + ' ' + str(number1) + ' ' + str(number2) + ' ' + str(number3) + ' ' + str(number4) + ' ' + str(number1) + ' ' + str(number2) + ' ' + str(number3) + ' ' + str(number4) + ' ' + str(number1) + ' ' + str(number2) + ' ' + str(number3) + ' ' + str(number4))
numbersCode()
#def getIp():
# x = random.randint(1, 222)
# if x == 127:
# x += 1
# return '{}.{}.{}.{}'.format(
# x,
# random.randint(0, 255),
# random.randint(0, 255),
# random.randint(0, 255))
def usernameCreation():
username = input(">>> ")
print("'" + username + "' is that correct?")
usernameInput = input(">>> ")
if usernameInput == ("yes"):
print("Okay...")
if usernameInput ==("no"):
usernameCreation()
def game():
def tutorial():
print('Hello.')
time.sleep(3)
print('Welcome back.')
time.sleep(3)
print("You're probably wondering who I am.")
time.sleep(3)
print("You might also be wondering what the hell is happening")
time.sleep(5)
print('Well, my name is Null')
time.sleep(3)
print("And I'm dead.")
time.sleep(5)
print("I've downloaded new software onto your computer.")
os.system('cls')
print("First thing's first, what shall I call you?")
usernameCreation()
time.sleep(3)
def firstMove():
print("""Let's give you some movement. What you're going to have to do
is type, getIp(Null), in other cases you will have to replace Null with
the person's screen name. It IS case sensitive""")
firstMove()
def repeatCommand1():
print('Go right ahead, getIp(Null)')
commandInput = input(">>> ")
if ('getIp(Null)'):
numbers()
time.sleep(3)
print('Ip address added to your nodes.')
time.sleep(2)
os.system('cls')
print("""Now you will need to type myNodes(), which will give you access to all the
ip addresses you have found out so far. Then you will need to type in the
screen name of the person you need the ip of.""")
def myNodes1():
print("So go ahead. myNodes()")
input(">>> ")
if ('myNodes()'):
nodes1()
print("""I just downloaded a bypasser and a password decrypter to your computer. I want you to try
to hack into my computer. First use, connectIp(18.226.109)""")
input(">>> ")
if ('connectIp(18.226.109)'):
connectNull_Tutorial()
else:
print('That is an incorrect command.')
myNodes1()
myNodes1()
else:
repeatCommand1()
repeatCommand1()
tutorial()
game()
The problem with the program, is that where there is an if/else command, it doesn't work. I tested out the program just now, to see that when I enter in any sort of input (wherever in the code it says input('>>> ') and then:
if ('blah'):
print('blah')
then:
else:
commandThatgoesBack
I'll try clarifying. Where it says:
def repeatCommand1():
print('Go right ahead, getIp(Null)')
commandInput = input(">>> ")
if ('getIp(Null)'):
numbers()
time.sleep(3)
print('Ip address added to your nodes.')
time.sleep(2)
os.system('cls')
print("""Now you will need to type myNodes(), which will give you access to all the
ip addresses you have found out so far. Then you will need to type in the
screen name of the person you need the ip of.""")
def myNodes1():
print("So go ahead. myNodes()")
input(">>> ")
if ('myNodes()'):
nodes1()
print("""I just downloaded a bypasser and a password decrypter to your computer. I want you to try
to hack into my computer. First use, connectIp(18.226.109)""")
input(">>> ")
if ('connectIp(18.226.109)'):
connectNull_Tutorial()
else:
print('That is an incorrect command.')
myNodes1()
myNodes1()
else:
repeatCommand1()
It clearly, or somewhat clearly states that if you input blah, do this, if you enter anything else, start from the beginning, and input again, over and over until you input the correct thing. Such as:
def goBack():
print('Enter getIp(Null)')
input()
if ('getIp(Null)'):
print('Good job mate')
else:
goBack()
goBack()
(Do note that the code above is used as an example and not necessarily exactly how my code in the actual program is). The program seems to take any input that I enter, and still (using the example above) prints 'Good job mate', even if I don't enter getIp(Null). Every single place in my code where something like the code above appears, the same error pops up. I can literally run the program, and play the whole (current) game just by pressing enter. Anyone know what to do?
result = input(">>>")
if result == "Something":
do_something()
this is pretty basic ... you should probably be running your code more often ...
Related
I have written this code but it is not writing the data in the file.
import random
import datetime
while(True):
def getdate():
import datetime
return datetime.datetime.now()
#will take input from the user
userInput = int(input("What do you want to do: \n 1) Spin minecraft Challenge Wheel \n 2) Spin Pro Challenge Wheel \n 3) Retrieve Data \n Write there serial number to choose: \n"))
if userInput==1:
minecraftchallengewheel = ["Do nothing", "Kill ender dragon in 1 minute in any gamemode", "download herobrine mod", "delete your favorite world", "Kill wither in 1 minute", "Be friend of wither"]
minecraftchallengechoice = random.choice(minecraftchallengewheel)
minecraftchallengechoicelist = minecraftchallengechoice
print(f"You have to {minecraftchallengechoice}")
print("Do you want to log the data? (y/n) \n")
minecraftchallengeyn = input()
if minecraftchallengeyn == "y":
with open("challengelog.txt", "a") as f:
f.write(str([str(getdate())]) + ": " + minecraftchallengechoicelist + "\n")
This code worked here.
import random
import datetime
def getdate():
return datetime.datetime.now()
while(True):
#will take input from the user
userInput = int(input("What do you want to do: \n 1) Spin minecraft Challenge Wheel \n 2) Spin Pro Challenge Wheel \n 3) Retrieve Data \n Write there serial number to choose: \n"))
if userInput==1:
minecraftchallengewheel = ["Do nothing", "Kill ender dragon in 1 minute in any gamemode", "download herobrine mod", "delete your favorite world", "Kill wither in 1 minute", "Be friend of wither"]
minecraftchallengechoice = random.choice(minecraftchallengewheel)
minecraftchallengechoicelist = minecraftchallengechoice
print(f"You have to {minecraftchallengechoice}")
print("Do you want to log the data? (y/n) \n")
minecraftchallengeyn = input()
if minecraftchallengeyn == "y":
try:
with open("challengelog.txt", "a") as f:
f.write(str([str(getdate())]) + ": " + minecraftchallengechoicelist + "\n")
except IOError:
print('Fail to open the file')
The challengelog.txt file.
['2021-08-23 11:55:54.880117']: Kill ender dragon in 1 minute in any gamemode
['2021-08-23 11:56:39.066004']: Kill ender dragon in 1 minute in any gamemode
['2021-08-23 11:57:02.427010']: download herobrine mod
['2021-08-23 12:01:23.214895']: Be friend of wither
When I run the below program it does input verification correctly and it performs the Collatz Sequence just fine. The issue is that it doesn't loop back to the beginning. I have tried removing the "break" in the second part, I have tried moving the second block around, and other small stuff, but I can't get it to go back to the input again to start over.
#Collatz Sequence
import sys
#main part of input and processing number
print ('Collatz Sequence, Y\'all!')
try:
while True:
print ('Please type in an integer greater than 1. Type (q) to quit.')
number = input()
if number == 'q':
print ('OK, see ya!')
sys.exit() # quit the program
if number.isdecimal() == True: #checks that input is a number
number = int(number)
break #breaks out of loop
print ('Please type in a number')
while True:
maybe = number%2
#print ('DEBUG ' + 'maybe is ' + str (maybe) + ' number is ' + str (number))
if number == 1:
print (' ')
print (' ')
print ('Final answer is 1.')
print (' ')
print ('Let\'s do it again:')
print (' ')
break
elif maybe == 0:
print (' ')
print (str(number) + ' is even.')
number = number//2
elif maybe == 1:
print (' ')
print (str(number) + ' is odd.')
number = 3 * number + 1
print ('Recalculating')
except KeyboardInterrupt:
sys.exit()
Try making your logic simpler and you will see your problem. Your current logic is:
try:
while True:
<get number>
if <want to quit>: sys.exit()
if <number is good>: break
while True:
if <done>: break
<step>
except KeyboardInterrupt:
sys.exit()
It sounds like you want something more like
try:
while True:
while True:
<get number>
if <want to quit>: sys.exit()
if <number is good>: break
while True:
if <done>: break
<step>
except KeyboardInterrupt:
sys.exit()
You are confusing the fact that you use loops to get input and calculate the path with needing to use a loop to continue that process. Functions would make this much more obvious.
I was attempting to create a quiz and one of the criteria is to limit the time available to solve for each question in the quiz. I looked up certain tutorials but some require an input of x seconds for the timer to go off while others looked more like a stopwatch...
I was wondering how do I do like a background timer that ticks down as soon as the question is printed out and skips to the next question if, for example the 30-second period has ended? I'm clueless in the timer function and was having problems to even try to implement them onto my codes. Could someone give out a few pointers so I can sorta progress further in implementing a working timer?
Thank you!
EDITED section below:
The timer that I want to implement onto my coding:
import time
import threading
def atimer():
print("Time's up.")
a_timer = threading.Timer(10.0, atimer)
a_timer.start()
print("")
This is the whole coding that I tried to implement the timer into.
I noticed that when I tried to define qtimer to just print 1 or 2 lines of statements the timer works but I want the timer to stop and go to second question or stop and give the user another attempt to retry the question, so I tried to attach a bunch of codes after the definition and it didn't work. I know I'm most probably doing something wrong here since I'm not quite familiar with time or threading functions. Is there a workaround?
def qtimer():
print("I'm sorry but your time is up for this question.")
print("You may have another attempt if you wish to, with reduced marks allocated.")
response1 = input("Type 'Yes' for another attempt, anything else to skip: ")
if response1 == "Yes":
Answ = input("Which option would you go for this time?: ")
Answ = int(Answ)
if possible[Answ - 1] == qaItem.corrAnsw:
print("Your answer was correct.")
corr += 1
marks += 0.5 * qaItem.diff
else:
print("Your answer was wrong.")
print("Correct answer was: " + qaItem.corrAnsw)
print("Explanation: " + qaItem.expl)
print("")
else:
print("Correct answer was: " + qaItem.corrAnsw)
print("Explanation: " + qaItem.expl)
print("")
class A:
def __init__(self, question, correctAnswer, otherAnswers, difficulty, explanation):
self.question = question
self.corrAnsw = correctAnswer
self.otherAnsw = otherAnswers
self.diff = difficulty
self.expl = explanation
qaList = [A("What is COVID-19?", "Coronavirus Disease 2019", ["Wuhan virus", "I don't understand...", "Coronavirus Disease v19"], 1, "Explanation 1"),
A("What describes COVID-19?", "A disease", ["A virus", "A parasite", "A bacteriophage"], 1, "Explanation 2"),
A("What causes COVID-19?", "SARS-CoV-2", ["Coronavirus", "Mimivirus", "Rubeola Virus"], 1, "Explanation 3"),
A("Which of the following is used in COVID-19 treatment?", "Lopinavir / Ritonavir ", ["Midazolam / Triazolam", "Amiodarone", "Phenytoin"], 2, "Explanation 4"),
A("Which of the following receptors is used by COVID-19 to infect human cells?", "ACE-2 Receptors", ["ApoE4 Receptors", "TCR Receptors", "CD28 Receptors"], 3, "Explanation 5")]
corr = 0
marks = 0
random.shuffle(qaList)
for qaItem in qaList:
q_timer = threading.Timer(5.0, qtimer)
q_timer.start()
print(qaItem.question)
print("Possible answers are:")
possible = qaItem.otherAnsw + [qaItem.corrAnsw]
random.shuffle(possible)
count = 0
while count < len(possible):
print(str(count+1) + ": " + possible[count])
count += 1
print("Please enter the number of your answer:")
Answ = input()
Answ = str(Answ)
while not Answ.isdigit():
print("That was not a number. Please enter the number of your answer:")
Answ = input()
Answ = int(Answ)
Answ = int(Answ)
while Answ > 4 or Answ < 1:
print("That number doesn't correspond to any answer. Please enter the number of your answer:")
Answ = input()
Answ = int(Answ)
if possible[Answ-1] == qaItem.corrAnsw:
print("Your answer was correct.")
corr += 1
marks += 1 * qaItem.diff
else:
print("Your answer was wrong.")
response = input("Would you want to try again? If so, input 'Yes' to attempt it again, if not just input whatever!")
if response == "Yes":
Answ = input("Which option would you go for this time?: ")
Answ = int(Answ)
if possible[Answ - 1] == qaItem.corrAnsw:
print("Your answer was correct.")
corr += 1
marks += 0.5 * qaItem.diff
else:
print("Your answer was wrong.")
print("Correct answer was: " + qaItem.corrAnsw)
print("Explanation: " + qaItem.expl)
print("")
else:
print("Correct answer was: " + qaItem.corrAnsw)
print("Explanation: " + qaItem.expl)
print("")
print("You answered " + str(corr) + " of " + str(len(qaList)) + " questions correctly.")
print("You have achieved a total score of " + str(marks) + ".")
Even with a timer, the main thread can't proceed past waiting for the user to input a number; so if the user doesn't nothing, the timer function runs, and once it has finished the main thread is still waiting for input at
print("Please enter the number of your answer:")
Answ = input()
You could have a global flag that the timer thread sets to tell the main thread to treat the input received as response1 in the timer code, and also have a flag to tell the timer that an answer was received, and so on, and it quickly becomes rather complicated.
So rather than trying to work around the blocking call to input by communicating between the timer and main thread, take the non-blocking input example from https://stackoverflow.com/a/22085679/1527 and stop the loop early if the time is up.
def timed_input(msg, timeout=10):
kb = KBHit()
print(msg)
end_time = time.time() + timeout
warn_time = 5
result = None
while True:
if kb.kbhit():
c = kb.getch()
if '0' <= c <= '9':
result = int(c)
break
print(c)
if time.time() > end_time:
print('time is up')
break
if time.time() > end_time - warn_time:
print(f'{warn_time}s left')
warn_time = warn_time - 1
kb.set_normal_term()
return result
# Test
if __name__ == "__main__":
result = timed_input('Enter a number between 1 and 4')
if result is None:
print('be quicker next time')
elif 1 <= result <= 4:
print('ok')
else:
print(f'{result} is not between 1 and 4')
Note also that breaking up into smaller functions helps make the code easier to follow, the logic of the test doesn't need to know about the logic of the timeout.
So I am coding a checklist in Python 3.5.2. Part of my checklist is the function that is removing something in the list by typing the name of the thing in the list. I have been trying to figure out a way to do it but have not found one.
Here is the code that I am working with:
import time
import random
#Intro tells player how to use program
def displayIntro():
print("Hello there, welcome to your Python Checklist.")
time.sleep(2)
print("Please type the name of the chore e.g. rubbish.")
time.sleep(2)
print("To remove a completed chore, type ‘done’ then the name of the chore e.g. done rubbish.")
time.sleep(3)
print("It will tick the box next to the chore you said. ☑")
time.sleep(2)
print("To show unfinished chores type ‘display’ with check boxes next to them. ☐")
#Stores user input in a list
def nameChores():
chores = ''
chores2 = ()
chores3 = ''
chores2 = input('Type chore name: ').split()
print("Chore(s) is now stored.")
while chores != 'display' and chores in chores2:
time.sleep(0.5)
print('Make sure to look at the intro for the commands.')
chores = input().lower()
#Displays the unfinished chores that the player has typed in and appear with unfilled checkboxes next to them
if chores == 'display':
print(chores2)
return chores
#Program looks for chore name and removes it from the list. Says to player it is removed with a tick next to it.
if chores in chores2:
chores2.remove(chores)
print("Chore is now remove. ☑")
nameChores()
import time
currentChores = []
finishedChores = []
def displayIntro():
print("Hello there, welcome to your Python Checklist.")
time.sleep(2)
print("Please type the name of the chore e.g. rubbish.")
time.sleep(2)
print("To remove a completed chore, type ‘done’ then the name of the chore e.g. done rubbish.")
time.sleep(3)
print("It will tick the box next to the chore you said. ☑")
time.sleep(2)
print("To show unfinished chores type ‘display’ with check boxes next to them. ☐")
def nameChores():
chore = input("Type chore name: ")
if (chore == "display"):
print(currentChores)
elif ("done " in chore):
subString = chore.replace("done ", "")
if subString in currentChores:
currentChores.remove(subString)
finishedChores.append(subString)
print("Chore: " + subString + " was removed from your chore list")
else:
print("The chore: " + subString + " doesn't exist in your chore list")
elif (chore not in currentChores):
currentChores.append(chore)
print("Chore: " + chore + " was added to your chore list")
def main():
nameChores()
main()
This code snippet will execute the displayChores intro, and then proceed to continuously add chores to the currentChores list by having the nameChoresfunction in a infinite loop
If a chore is added twice, the chore will be removed from the currentChores list and added to the finishedChores list, where you easily can access all finished chores
You can easily make the script stop whenever you want by modifying the nameChores function:
def nameChores():
while True:
chore = input("Type chore name: ")
if (chore == "display"):
print(currentChores)
elif (chore == "stop"):
break
elif ("done " in chore):
subString = chore.replace("done ", "")
if subString in currentChores:
currentChores.remove(subString)
finishedChores.append(subString)
print("Chore: " + subString + " was removed from your chore list")
else:
print("The chore: " + subString + " doesn't exist in your chore list")
elif (chore not in currentChores):
currentChores.append(chore)
print("Chore: " + chore + " was added to your chore list")
I'm in the middle of making a small game involving hacking into people's computers, and stealing files and money in order to complete missions. Here is the code as of now:
#SICCr4k2: Broke
#
#
#
#Remember whenever you are printing a random ip address to add the "." in between each part of the ip (each random number)
## LAST LEFT ON HERE: MAKE BUTTONS FOR NODES
## MAKE FILES FOR NULL'S NODE
## SET THE CORRECT PLACEMENTS FOR ALL THE BUTTONS
## nullMain referenced before assignment
## make it so that you send a message through the prompt to get their ip, then it automatically puts the ip in the nodes
## window. Like you send the person a message, and then it gets the ip and puts it in the nodes window
## take away the buttons in the nodes window, just at labels where it points to the host's ip address.
import random
import time
import sys
import os
import tkinter as tk
from tkinter import *
#def nodes():
# nodeWindow = tk.Tk()
# frame = tk.Frame(nodeWindow, width=700, height=400)
# frame.grid_propagate(0)
# frame.grid()
# nodeWindow.title("||| Nodes |||")
# nullIp = tk.Label(nodeWindow, text="Ip: 221.153.52.216")
# nullIp.grid(row=0, column=0)
# nullMain = tk.Button(nodeWindow, text="Null", function=nullMainCallback())
# nullMain.config(height=1, width=100)
# nullMain.grid(row=0, column=0)
# def nullMainCallback():
# nullMain.destroy()
# nullIp = tk.Label(nodeWindow, text="Ip: 221.153.52.216")
# nullIp.grid(row=0, column=0)
#def commands():
def numbers():
number1 = random.randint(1, 99)
number2 = random.randint(1, 99)
print(number1)
if number1 != number2:
numbers()
if number1 == number2:
os.system('cls')
def ips():
nullIp = ('18.279.332')
def getIp():
x = random.randint(1, 222)
if x == 127:
x += 1
return '{}.{}.{}.{}'.format(
x,
random.randint(0, 255),
random.randint(0, 255),
random.randint(0, 255))
def commandInput():
CommandInput = input(">>> ")
if CommandInput == ("myNodes()"):
nodes()
else:
commandInput()
commandInput()
def usernameCreation():
username = input(">>> ")
print("'" + username + "' is that correct?")
usernameInput = input(">>> ")
if usernameInput == ("yes"):
print("Okay...")
if usernameInput ==("no"):
usernameCreation()
def game():
def tutorial():
print('Hello.')
time.sleep(3)
print('Welcome back.')
time.sleep(3)
print('How was it?')
time.sleep(3)
print('Being hacked for the first time?')
time.sleep(3)
print("You're probably wondering who I am.")
time.sleep(5)
print("Well, my name is Null.")
time.sleep(3)
print("Only because I am well known for nothing.")
time.sleep(3)
print("Other than not being alive.")
time.sleep(3)
os.system('cls')
print("First thing's first, what shall I call you?")
usernameCreation()
print("Let's give you a bit of movement.")
time.sleep(3)
print("""The first thing you will want to do would be to connect to my computer, but
to do that, you have to find my ip address. Here. I just uploaded new software to your computer.""")
time.sleep(3)
print("""You will now be able to access my ip, nad many other's with a simple command. The command is
getIp(). Input that command below, but inside the parenthesis, you type in the screen name. For instance: getIp(Null).
type that command in to get my ip.""")
input(">>> ")
if ("getIp(Null)"):
numbers()
print("""My ip was just added to your nodes, which you can access by typing myNodes().""")
game()
I just want to note that when I run the program, it doesn't list any errors or anything, it just doesn't execute at all... Any ideas????
You define the function tutorial inside game (which you shouldn't really do – there's no point in defining it that way) but never call tutorial.
Inside of game you want to call tutorial:
def game():
def tutorial():
# code for tutorial
tutorial()
A better way to structure your code, however, is to use a main method (which is the standard way to start the execution of a program` and keep every other function separate. There's no need to nest functions as you've done.
So, for example:
def main():
tutorial()
# all other function definitions
def tutorial():
# code for tutorial
if __name__ == "__main__":
main()
You never call tutorial() although you shouldn't nest functions like this.