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
Related
I'm making a kahoot botter and this is the code:
from colorama import Fore
from kahoot import client
import pyfiglet
import sys
def joinHandle():
pass
print(Fore.BLUE + pyfiglet.figlet_format("Kahoot Bot"))
print(Fore.BLUE + "Coded by AsyncCode <3 | https://discord.gg/99KDZYwn2c")
username = input(Fore.BLUE + "Tell me the Bots name. > ")
code = input(Fore.BLUE + "Tell me the Kahoot's Game Code. > ")
int(code)
if code.isdigit() is False:
print(Fore.BLUE + "Error, the Code must be an Integer.")
sys.exit(1)
logging = input(Fore.BLUE + "Tell me if you want to enable logging. y / n > ")
bots = input(Fore.BLUE + "How many bots do you want? ")
for x in bots:
bot = client()
BotID = x
BotID = str(BotID)
bot.join(code, username + " - " + BotID)
bot.on("joined", joinHandle)
if logging == "y":
print(Fore.BLUE + "Log: Joining the Game (" + code + ") with Name: " + username + " - " + BotID + ".")
BotID = int(BotID)
If i enter 10 it will make bot - 1 and bot - 0 and not a range from 1 to ten
The bots variable is a string:
bots = input(Fore.BLUE + "How many bots do you want? ")
Your current code iterates over each character in the string.
Assuming you want to run as many iterations as the input value, you should first convert the string to an integer, and then iterate over a range with the same length as this integer:
bots = int(input(Fore.BLUE + "How many bots do you want? "))
for i in range(bots):
...
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.
basically i have made 4 question list and answer list the first one works fine but the next few don't work and come up with a error sometimes the first question is displayed but not the others
this is the tool and my code https://repl.it/#alandtic/final
Traceback (most recent call last):
File "main.py", line 155, in
print(question_list2[random_int])
IndexError: list index out of range
top_index=top_index-1
after deleting a question, you should atleast decrease top index.
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 14 10:38:13 2019
#author: jainil
"""
import random
print("\033[0;37;40m\n")
print("welcome to soldier to WW1")
print(
"If you are ready to die for your country then you must learn all the parts of a WW1 soldier. but first maggot answers a few personal questions. ")
first_name = input("What is your first name? ")
middle_name = input("what is your middle name? ")
last_name = input("what is your last name? ")
full_name = (first_name + " " + middle_name + " " + last_name)
print("Is this your correct name? " + full_name)
yes_or_no = input("Y/N ")
if yes_or_no == ("N"):
print("program will give you chance to renter name in do not mess up again this is your LAST chance")
first_name = input("What is your first name? ")
middle_name = input("what is your middle name? ")
last_name = input("what is your last name? ")
full_name = (first_name + " " + middle_name + " " + last_name)
print("this is your NAME NOW " + full_name)
print("before we get to the training base do you want basic info on how it works. ")
TRAINING = input("Y/N ")
if TRAINING == ("Y"):
print(
" welcome to basic training let’s go over basic need to know info? A typical day starts with Reveille (a bugle or trumpet call to wake the soldiers and call them to duty) at 5.30 a.m. After tidying up and cleaning your quarters and having a brew, at 6.30 recruits will parade for an hour and a half to work on your fitness. After breakfast at 8, the morning was spent drilling on the parade square, learning, for instance, to march, form fours and about turn . Between 12.15 and 2 p.m. troops men took lunch before returning for more drill in the afternoon until 4.15. The unlucky image you might be working parties the rafter, but otherwise recruits are off duty, although you might have to spend time cleaning kit and shining boots. In large garrison towns like Aldershot, you can have leisure facilities in the shape of the ‘Smith-Dorrien Soldiers’ Home’, with a billiards room, a library, recreation rooms, private baths and a buffet. ")
i_am_gay = input("are you ready for the test Y/N")
if i_am_gay == ("Y"):
import random
question_list = []
question_list.append("what time do you wake up? ")
question_list.append("what do you do at 6:30? ")
question_list.append("what is at Aldershot? ")
question_list.append("what time do you have lunch? ")
question_list.append("Do you need to go to bed at a specific time? ")
answer_list = []
answer_list.append("5:30")
answer_list.append("parade")
answer_list.append("Leasure")
answer_list.append("12:15")
answer_list.append("No")
top_index = 4
correct = 0
for i in range(0, 5):
random_int = random.randint(0, top_index)
print(question_list[random_int])
user_answer = input("enter your answer: ")
if user_answer == answer_list[random_int]:
print("\033[1;32;40m good job \n")
print("\033[0;37;40m\n")
correct = correct + 1
else:
print("\033[1;31;40m incorrect \n")
print("\033[0;37;40m \n")
del question_list[random_int]
del answer_list[random_int]
top_index=top_index-1
print("you scored " + str(
correct) + " out of 5 based on this you will receive a rank all scores are collected to give you a final rank at the end of our testing. ")
import os
import time
time.sleep(10)
os.system('clear')
print(
"The next step of your training is to chose a group to learn more about and train in all with different types ways to train. first is infantry (multiple choice questions) second is planing (tactics questions) and finally is marine (fill in the blank)")
form = input("please select which one you want 1/2/3 ")
if form == ("1"):
form = input("you have selected infantry is this correct if yes enter Y1 if no then put in your teams number")
if form == ("Y1"):
print(
"first step is to train you on the role of infantry. your main mission is to be a ground troop this includes but is not limited to. building trenches, fighting off front lines and attack the enemies trenches.")
print(
"now that your training is complete time for your first quiz this will be multiple choice and will be the main for your rank. ")
question_list1 = []
question_list1.append(
"which one of these is not your job? A: build trench B: act as a spy C: fight on the front lines D: follow orders ")
question_list1.append("who is your boss? A: the furrier B: privates C: civilians D: a lieutenant ")
question_list1.append("which weaponry is better for long range A:50 cow B: mp5 C: benelli M3 D: Barret M82 ")
question_list1.append(
"which is not a rank? A: master first sergeant B: command segment major C: corporeal: D: private ")
answer_list1 = []
answer_list1.append("B")
answer_list1.append("D")
answer_list1.append("D")
answer_list1.append("A")
top_index1 = 3
correct = 0
for i in range(0, 4):
random1_int = random.randint(0, top_index1)
print(question_list1[random1_int])
user_answer1 = input("enter [A] [B] [C] [D] : ")
if user_answer == answer_list1[random1_int]:
print("\033[1;32;40m good job \n")
print("\033[0;37;40m\n")
correct = correct + 2
else:
print("\033[1;31;40m incorrect \n")
print("\033[0;37;40m \n")
del question_list1[random1_int]
del answer_list1[random1_int]
top_index1 = top_index1 - 1
if form == ("2"):
form = input("you have selected planing is this correct if yes enter Y2 if no then put in your teams number")
if form == ("Y2"):
print(
"first step is to train you on the role of a planer. you need to give tips and info to your troops based on you skills. ")
print(
"now that your training is complete time for your first quiz this will be a tactics question and will be the main determination for your rank. ")
question_list2 = []
question_list2.append(
"side X has a large compound with 12 men and side + has the element of surprise and 3 elite troops ")
question_list2.append("side X has 3 troops and the high ground side + has 13 troops but is on the low ground ")
answer_list2 = []
answer_list2.append("x")
answer_list2.append("+")
top_index2 = 1
correct = 0
for i in range(0, 2):
random_int = random.randint(0, top_index2)
print(question_list2[random_int])
user_answer2 = input("which side has the advantage x or +? ")
if user_answer2 == answer_list2[random_int]:
print("\033[1;32;40m good job \n")
print("\033[0;37;40m\n")
correct = correct + 4
else:
print("\033[1;31;40m incorrect \n")
print("\033[0;37;40m \n")
del question_list2[random_int]
del answer_list2[random_int]
top_index2 = top_index2 - 1
if form == ("3"):
form = input("you have selected marine is this correct if yes enter Y3 if no then put in your teams number")
if form == ("Y3"):
print(
"first step is to train you on the role of a marine. you need to give tips and info to your troops based on you skills. ")
print(
"now that your training is complete time for your first quiz this will be fill in the blanks and will be the main determination for your rank. ")
question_list3 = []
question_list3.append(" the marines are ___ based operatives ")
question_list3.append(" for under water travel marines use _____ ")
question_list3.append(" the average marine trains for _ weeks ")
answer_list3 = []
answer_list3.append("sea")
answer_list3.append("submarines")
answer_list3.append("13")
top_index3 = 2
correct = 0
for i in range(0, 3):
random_inte = random.randint(0, top_index3)
print(question_list3[random_inte])
user_answer3 = input("fill in the blank with the correct word ")
if user_answer3 == answer_list3[random_inte]:
print("\033[1;32;40m good job \n")
print("\033[0;37;40m\n")
correct = correct + 3
else:
print("\033[1;31;40m incorrect \n")
print("\033[0;37;40m \n")
del question_list3[random_inte]
del answer_list3[random_inte]
top_index3 = top_index3 - 1
time.sleep(10)
os.system('clear')
print(
"congratulations on your finishing of the course i will now give you a rank based on your score from e1(private) to e9(major) ")
if correct == (1):
print("e1 i would say not bad but that should be a lie")
elif correct == (2):
print("e1 i would say not bad but that should be a lie")
elif correct == (3):
print("e2 not worthless but not good")
elif correct == (4):
print("e2 not worthless but not good")
elif correct == (5):
print("e3 now i will make a man out of you")
elif correct == (6):
print("e3 now i will make a man out of you")
elif correct == (7):
print("e4 seems like front lines will be wasted on you")
elif correct == (8):
print("e5 good job mr wane")
elif correct == (9):
print("e6 no front line for you")
elif correct == (10):
print("e7 steve rogers would be proud")
elif correct == (11):
print("e8 welcome to the order")
elif correct == (12):
print("e9 no jokes you did very good my superior")
elif correct == (13):
print("you have no rank you scored 100% my bet is your cheater shame on you. ")
elif correct == (14):
print("this is a marine exclusive rank i added because i was lazy tbh. ")
you have not updated top index even,
Here is my code:-
f= open("Passes.py", "a+")
m=open("money.py","a+")
passes= {}
init={}
initial=0
import time
print "Welcome to the virtual banking system"
user=raw_input("Would you like to create a new account? 'Y/N'").lower()
if user== "y":
new_user= raw_input("Create a username:")
new_pass= raw_input("Create a password:")
p= passes[new_user]= new_user + ":" + new_pass
f.write("\n"+p)
ask=raw_input("Would you like to sign into your account? 'Y/N'").lower()
if ask=="y":
user_in=raw_input("Enter your username:")
if user_in==new_user:
pass_in=raw_input("Enter your password:")
if pass_in==new_pass:
print "Welcome to your account" + " " + new_user
**useropt=raw_input("Would you like to view your balance- enter 1, deposit money- enter 2, withdraw money- enter 3 or exit- enter 4:")**
if useropt=="1":
print "Your balance is:", initial
m.write(str(initial)+"\n")
if useropt=="2":
amountdep= int(raw_input("How much money would you like to deposit?:"))
initial+=amountdep
print "Thanks. Your new balance is:", initial
m.write(str(initial)+"\n")
if useropt=="3":
amountwith=int(raw_input("How much would you like to withdraw?:"))
initial-=amountwith
print "Your balance is:", initial
m.write(str(initial)+"\n")
else:
print "Password not valid"
else:
print "Username does not exist"
else:
print "Thanks for using the virtual bank."
else:
user2=raw_input("Do you have an existing account? 'Y/N'").lower()
if user2=="y":
existing_user=raw_input("Enter your username:")
exisitng_pass=raw_input("Enter your password:")
for passwords in f:
if passwords==existing_user+":"+exisitng_pass:
print "Welcome to your account" + " " + existing_user
with open("money.py", "r") as m:
info= int(m.readline().strip())
useropt2=raw_input("Would you like to view your balance- enter 1, deposit money- enter 2, withdraw money- enter 3 or exit- enter 4:")
if useropt2=="1":
print "Your balance is:", info
if useropt2=="2":
amountdep= int(raw_input("How much money would you like to deposit?:"))
a=info+int(amountdep)
print "Your new balance is:", a
with open("money.py", "w") as m:
m.write(str(a))
if useropt2=="3":
amountwith=int(raw_input("How much would you like to withdraw?:"))
t=info-int(amountwith)
print "Your balance is:", t
with open("money.py", "w") as m:
m.write(str(t))
I would like to know how I can create a loop to ask the user if he/she would like to choose another operation, such as the useropt variable after each time, one operation is complete. For instance at the end of each if statement where the user chooses a certain operation to do, I would like to know how I can ask the user again, if they would like to do another operation. Thanks.
After you import time you could do:
running = True
while running:
print "Welcome to the virtual banking system"
#the rest of your code, indented by one.
continue = raw_input("Would you like to do another operation? 'Y/N'").lower()
running = continue == "y"
This will give the user an option to quit after every operation, but restart otherwise.
Your code should be structured otherwise, using a while loop and a function to handle input.
General example :
# this code should go after creating a new account/entering an existing one
while True:
Ans = raw_input("what would you like to do? 1... 2... , -1 to exit")
int code = ProcessAns(int(Ans))
if code == -1:
print "bye!"
break
# and here the function that will be called every time
def ProcessAns(ans):
if ans == 1:
# do stuff
elif ans == 2:
# do other stuff
# include a way to get out
elif ans == -1:
return -1
return 1
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 ...