0

Trying To Make A PYTHON BOOT

import time print "Booting the operating system's information." time.sleep(2) name = raw_input("Enter your name. ") password = raw_input("Enter your password") if name == name: print "Verified name, verifying password." else: print "Name not verified." time.sleep(2) if password == password: print "Verified password." else: print "Password not verified." time.sleep(2) print "Welcome to TO-DOS, enter \'help\' to view commands." credits = ("You have entered credits, C 2017 TS-DOS ALL RIGHTS RESERVED") help = ("You have entered the command help, total commands: credits.") user = input("> ") Output: /Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7 "/Users/programmer/PycharmProjects/Folder One.py/document_one.py" Booting the operating system's information. Enter your name. Root Enter your passwordRoot Verified name, verifying password. Verified password. Welcome to TO-DOS, enter 'help' to view commands. > help Process finished with exit code 0 Description: The commands don't work.

10th Jul 2017, 11:31 PM
Gage Young
Gage Young - avatar
11 ответов
+ 6
print is a statement in 2.x Adding parentheses converts its parameters into a tuple. It's one of Guido's "Python regrets"* print is a function in 3.x * https://stackoverflow.com/a/6239909
11th Jul 2017, 12:18 AM
Kirk Schafer
Kirk Schafer - avatar
+ 5
Python 3.x: raw_input is replaced with input print() CodePlayground: You get 4-5 seconds of runtime at most 3x sleep(2) causes "Timeout Exceeded" This is one way to print the user input: eval("print(" + user + ")") You could also test the input against a valid string: if user == 'help': print(help)
11th Jul 2017, 12:42 AM
Kirk Schafer
Kirk Schafer - avatar
+ 2
@Andres Compilers here has 3.x compilers, you win xD
11th Jul 2017, 12:11 AM
Complex
Complex - avatar
+ 1
Write the code on the playground plz
10th Jul 2017, 11:43 PM
Andrés04_ve
Andrés04_ve - avatar
10th Jul 2017, 11:45 PM
Gage Young
Gage Young - avatar
+ 1
print is a function, must have parentheses
10th Jul 2017, 11:48 PM
Andrés04_ve
Andrés04_ve - avatar
+ 1
That is untrue, tho print can have parentheses.
10th Jul 2017, 11:50 PM
Gage Young
Gage Young - avatar
+ 1
2.x: Parentheses not needed 3.x: Parentheses needed
11th Jul 2017, 12:08 AM
Complex
Complex - avatar
+ 1
Oh! My mistake xD Playground shows that error
11th Jul 2017, 12:09 AM
Andrés04_ve
Andrés04_ve - avatar
+ 1
lmao xD
11th Jul 2017, 12:12 AM
Andrés04_ve
Andrés04_ve - avatar
+ 1
xDD
11th Jul 2017, 12:12 AM
Complex
Complex - avatar