• API
• FAQ
• Tools
• Archive
SHARE
TWEET

# textlineos

a guest Feb 13th, 2020 147 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. #import assets
2. import time
3. import sys
4. import random
5. import os
6.
7. #calculator
8. def calculator():
10.  print ("2. Subtraction")
11.  print ("3. Multiplacation")
12.  print ("4. Division")
13.  print ("5. Primes to 100")
14.  print ("")
15.  question = input("Please select a option")
16.
17.  if question == "1":
18.     num1 = int(input("Enter first number: "))
19.     print (num1)
20.     num2 = int(input("Enter second number: "))
21.     print (num2)
22.     print ("")
23.     ans = num1 + num2
24.     print (ans)
25.     bktoclk = input("Go back to calculator? [y/n]")
26.     if bktoclk == "y":
27.      calculator()
28.     if bktoclk == "n":
30.  if question == "2":
31.     num1 = int(input("Enter first number: "))
32.     print (num1)
33.     num2 = int(input("Enter second number(what will be subtracted): "))
34.     print (num2)
35.     print ("")
36.     ans = num1 - num2
37.     print (ans)
38.     bktoclk = input("Go back to calculator? [y/n]")
39.     if bktoclk == "y":
40.      calculator()
41.     if bktoclk == "n":
43.  if question == "3":
44.     num1 = int(input("Enter first number: "))
45.     print (num1)
46.     num2 = int(input("Enter second number: "))
47.     print (num2)
48.     print ("")
49.     ans = num1 * num2
50.     print (ans)
51.     bktoclk = input("Go back to calculator? [y/n]")
52.     if bktoclk == "y":
53.      calculator()
54.     if bktoclk == "n":
56.  if question == "4":
57.     num1 = int(input("Enter first number(dividend): "))
58.     print (num1)
59.     num2 = int(input("Enter second number(divisor): "))
60.     print (num2)
61.     print ("")
62.     ans = num1 / num2
63.     print (ans)
64.     bktoclk = input("Go back to calculator? [y/n]")
65.     if bktoclk == "y":
66.      calculator()
67.     if bktoclk == "n":
69.  if question =="5":
70.    print ("")
71.    print ("2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89 and lastly 97.")
72.  if question == "6":
73.     print ("test")
74. #dice roll program
75. def diceroll():
76.  min = 1
77.  max = 6
78.
79.  roll_again = "yes"
80.
81.  while roll_again == "yes" or roll_again == "y":
82.     print ("Rolling the dices...")
83.     print ("The values are....")
84.     print (random.randint(min, max))
85.     print (random.randint(min, max))
86.     bktodice = input("Roll Again? [y/n]")
87.     if bktodice == "y":
88.      diceroll()
89.     if bktodice == "n":
91.
92. def cointoss():
93.     import random#Importing the random library.
94.     toss=random.randint(0,1)#Toss variable's value randomly generated between the numer 0 and 1.
95.     if toss==0:#If the varaiable is equal to 0 then:
96.         print("")
98.         cgoag()
99.
100.     else:#If the Toss is not 0 then:
101.         print("")
102.         print("You Flipped Tails")#Tails is displayed
103.         cgoag()
104.
105.
106. def cgoag():
107.     goagain = input("Toss Again? [y/n]")
108.     if goagain == "y":
109.         cointoss()
110.     if goagain == "n":
112.
113.
114. def clocksingle():
115.  while True:
116.     from datetime import datetime
117.     now = datetime.now()
118.     print ("")
119.     print ("%s/%s/%s %s:%s:%s" % (now.month,now.day,now.year,now.hour,now.minute,now.second))
121.
122. def randomnumgen():
123.     import random
124.     print(random.randint(0,100))
125.     bktordm = input("Generate Again? [y/n]")
126.     if bktordm == "y":
127.      randomnumgen()
128.     if bktordm == "n":
130.
131.
133.     print("")
134.     print("*********************************")
136.     print("*********************************")
137.     print("")
139.     print("1. Create New User")
140.     print("2. Change Log")
141.     print("3. Make New Admin Account")
143.     print("5. SYSTEM LOG")
144.     print("6. Dump System Log")
147.            print ("")
148.            register()
160.            dumpsystemlog()
161.
162.
164.     if os.path.exists("systemlog.txt"):
165.         print("SYSTEM LOG IS DELYAED BY A SESSION")
166.         f = open("systemlog.txt", "r")
167.         print("")
168.         print("--")
170.         print("--")
172.     else:
173.       print("*************************************")
174.       print("ERROR: System Log file does not exist")
175.       print("*************************************")
177.
178.
179.
180.
181. def dumpsystemlog():
182.  if os.path.exists("systemlog.txt"):
183.   os.remove("systemlog.txt")
185.  else:
186.   print("*************************************")
187.   print("ERROR: System Log file does not exist")
188.   print("*************************************")
190.
191.
194.     version = input("Please Input Version Number")
195.     changed = input("Please Input The Changes")
196.     file = open("changelog.txt","a")
197.     file.write("")
198.     file.write(version)
199.     file.write("--")
200.     file.write(changed)
201.     file.write("\n")
202.     file.close()
205.
206. def checkperms():
210.         login_info = line.split() # Split on the space, and store the results in a list of two strings
212.             print("Correct credentials!")
214.             f = open("systemlog.txt", "a")
216.             f.write("\n")
217.             f.close()
218.             return True
221.     f = open("systemlog.txt", "a")
223.     f.write("\n")
224.     f.close()
225.     print("")
226.     return False
227.
228.
234.     file.write(" ")
236.     file.write("\n")
237.     file.close()
238.     f = open("systemlog.txt", "a")
240.     f.write("\n")
241.     f.close()
244.
245. def changelog():
246.     f = open("changelog.txt", "r")
247.     print("")
248.     print("--")
250.     print("--")
251.     bktordm = input("Go back to menu?[y/n]")
252.     if bktordm == "y":
254.     if bktordm == "n":
255.      changelog()
256.
258.     f = open("changelog.txt", "r")
259.     print("")
260.     print("--")
262.     print("--")
263.     bktordm = input("Go back to menu?[y/n]")
264.     if bktordm == "y":
266.     if bktordm == "n":
268.
269.
274.         print ("")
275.         print("*****************************")
276.         print("***   TextLineOS - Menu    ***")
277.         print("*****************************")
278.         print("")
280.         print ("")
281.         print ("0. Log off")
282.         print ("1. Calculator")
283.         print ("2. Roll The Dice")
284.         print ("3. Current Time")
285.         print ("4. Random Number Generator")
286.         print ("5. Read System Change Log")
287.         print ("6. Flip A Coin")
293.            calculator()
295.            diceroll()
297.            sys.exit
299.            clocksingle()
301.            randomnumgen()
303.            checkperms()
305.            sys.exit
307.            changelog()
309.             cointoss()
312.
314.     print("****************************************")
315.     print("***   TextLineOS - Conversion Menu   ***")
316.     print("****************************************")
317.     print("")
318.     print("0. Exit")
319.     print("1. Hours To Minutes")
320.     print("2. Minutes To Hours")
325.         hrtomin()
327.         mintohr()
328.
329. def hrtomin():
330.     print("Hour to minutes")
331.     hours = int(input("Enter Hours: "))
332.     qsc1 = hours * 60
333.     print ("Total Minutes:")
334.     print (qsc1)
335.     bcktoconv()
336.
337. def mintohr():
338.     print("Minutes To Hours")
339.     hours = int(input("Enter Minutes: "))
340.     qsc2 = hours / 60
341.     print ("Total Minutes:")
342.     print (qsc2)
343.     bcktoconv()
344.
345.
346. def bcktoconv():
352.
353.
354. def register():
357.     file = open("accountfile.txt","a")
359.     file.write(" ")
361.     file.write("\n")
362.     file.close()
363.     f = open("systemlog.txt", "a")
364.     f.write("Successful Registration|User")
365.     f.write("\n")
366.     f.close()
367.     print("Account Created!")
369.
372.     print("*****************************")
373.     print("***  TextLineOS - Login   ***")
374.     print("*****************************")
375.     print("")
379.         login_info = line.split() # Split on the space, and store the results in a list of two strings
381.             print("Correct credentials!")
383.             f = open("systemlog.txt", "a")
385.             f.write("\n")
386.             f.close()
387.             return True
390.     f = open("systemlog.txt", "a")
392.     f.write("\n")
393.     f.close()
394.     print("")
395.     return False
396.
397.
398.
400.
401. #f = open("systemlog.txt", "a")
402. #f.write("SYSTEM STARTUP")
403. #f.write("\n")
404. #f.close()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.
Top