Ask coding questions

← Back to all posts
i need help making jarvis
theopythontest (0)

so far all he can do is tell you the time

Answered by JonDoeBeep (42) [earned 5 cycles]
View Answer
Comments
hotnewtop
JonDoeBeep (42)

What do you need help doing with jarvis?

theopythontest (0)

@JonDoeBeep i need a login system that also has it so if you want the time and input the cmd time then you have to be logged in otherwise it doesnt work

JonDoeBeep (42)

@theopythontest Maybe put the time inside of a function and then make it run on login (I'm not great at explaining so i will post an example.)

from time import time, ctime
def otime():
  t = time()
  print(ctime(t))
def logon():
  passw=12345
  user=1234
  print("enter username and password")
  u1 = int(input("Username: "))
  p1 = int(input("Password: "))
  if (p1 == passw and u1 == user):
     print("Logged on!")
     otime()
   else:
     print("Try again!")
     logon()
logon()
theopythontest (0)

@JonDoeBeep the login works but

enter username and password
Username: f
Password: h
Logged on!
Traceback (most recent call last):
File "main.py", line 17, in <module>
logon()
File "main.py", line 13, in logon
otime()
NameError: name 'otime' is not defined

JonDoeBeep (42)

@theopythontest make the first function name be otime
also updated the code so if you want to copy that it should work

theopythontest (0)

@JonDoeBeep it works perfectly thx.if u want u can have the code i am using so then if u ever want to make an ai u are already started