That is very simple math. Try to see if you can come up with something more complex(You should tell the user that they can use a caculator.) Also in line 34 what if the answer is "1221" or somthing random like that?
DragonMastur 23 Light Poster
Yes I have my username and password in there but that is for my raspberry pi. Not any of my other acounts.
DragonMastur 23 Light Poster
What your asking sound a lot like what Im making right now. here is what I have so far...
Note: If you run the program you will have to make some .txt file and change the directories.
import time
i = ""
fileContents = ""
#User 1
password1 = "hellomynameis"
username1 = "DragonMastur"
#User 2
password2 = "michael"
username2 = "aiden"
#User 3
password3 = "..........."
username3 = "..........."
line = "A line looks."
class Book:
def readBook(self, line):
print "Fetching Book..."
file = open('/home/pi/BookFolder/book.txt', mode='r')
time.sleep(1)
print "Done"
time.sleep(1)
print "\n\n\n"
while line != "":
line = str(file.readline())
print line
print "\n\n\n"
def readBook2(self, line):
print "Fetching Book..."
file = open('/home/pi/BookFolder/book2.txt', mode='r')
time.sleep(1)
print "Done"
time.sleep(1)
print "\n\n\n"
while line != "":
line = str(file.readline())
print line
print "\n\n\n"
def readBook3(self, line):
print "Fetching Book..."
file = open('/home/pi/BookFolder/book3.txt', mode='r')
time.sleep(1)
print "Done"
time.sleep(1)
print "\n\n\n"
while line != "":
line = str(file.readline())
print line
print "\n\n\n"
def __init__(self):
i = "Input from the user."
while True:
print 'Enter Your Username: '
u = raw_input()
if u == username1 or u == username2 or u == username3:
print "Enter Your Password: "
p = raw_input()
if p == password1 and u == username1 or p == password2
and u == username2 or p == password3 and u == username3:
while i != "q" or i != "Q":
print "-------Menu-------"
print "Look at book 1"
print "Quit Q"
i = raw_input()
if i == "1":
if u == username1:
self.readBook(line) …
DragonMastur 23 Light Poster
I have made a py editor which you can open save and run files. It is in python and is .py so you can just run as is.
import sys
if sys.hexversion >= 0x030000F0: #First find which version and imports to import
runningPython3 = True
else:
runningPython3 = False
if runningPython3:
import tkinter.filedialog as tk_FileDialog
from tkinter import*
from io import Stringl0 #This is not needed just make sure you import the correct libraries for your version
else:
from tkinter import*
import tkFileDialog as tk_FileDialog
from Stringl0 import Stringl0
recents = []
class PyEditor:
def doNew(self):
self.text.delete(0.0,END)
def doUndo(self):
self.text.edit_undo()
def doSaveAs(self):
file = tk_FileDialog.asksavefile(mode='w')
textoutput = self.text.get(0.0,END)
file.write(textoutput.rstrip())
file.write('\n')
def doOpen(self):
file = tk_FileDialog(mode='r')
fileContets = file.read()
recents.append(file)
self.text.delete(0.0,END)
self.text.insert(0.0,fileContents)
def doRun(self):
file = tk_FileDialog.askopenfile(mode='r')
os.system('c:\\Python25\\python ' + file.name)
def __init__(self):
self.root = Tk()
self.root.title('PyEditor1.0')
self.root.minsize(with=800,height=535)
menubar = Menu(self.root)
filemenu = Menu(menubar,tearoff=0)
filemenu.add_command(label='New File',command=self.doNew,accelerator='Ctrl+N)
file.add_command(label='Open',command=self.doOpen,accelerator='CtrlO')
filemenu.add_command(label='Save As',command=self.doSaveAs,accelerator='Ctrl+Shift+S')
filemenu.add_command(label='Run Program',command=self.doRun,accelerator='Ctrl+R')
editmenu = Menu(editmenu,tearoff=0)
editmenu.add_command(label='Undo',command=self.doUndo,accelerator='Ctrl+Z')
menubar.add_cascade(label='File',menu=filemenu)
self.root.config(menu=menubar)
editmenu.add_cascade(label='Edit',menu=editmenu)
self.root.config(menu=editmenu)
self.text = Text(self.root,undo=True)
self.text.pack(expand=YES,fill=BOTH)
if __name__ == '__main__':
app = PyEditor()
app.root.mainloop()
DragonMastur 23 Light Poster
I made a PyEditor so here are a few of the lines from it:
import sys
if sys.hexversion >= 0x030000F0: #First find which version and imports to import
runningPython3 = True
else:
runningPython3 = False
if runningPython3:
import tkinter.filedialog as tk_FileDialog
from tkinter import*
from io import Stringl0 #This is not needed just make sure you import the correct libraries for your version
else:
from tkinter import*
import tkFileDialog as tk_FileDialog
from Stringl0 import Stringl0
class files:
def Open(self): #Now open the file
f = tk_FileDialog.askopenfile(mode='r')
self.fileContents = f.read()
self.fileName = f.name #So it can be accessed where ever
f.close()
def Write(self, lines):
f = open(self.fileName, 'w')
f.writelines(lines)
f.close()
if __name__ == '__main__':
F = files()
F.Open()
line = raw_input()
F.Write(line)