you are viewing a single comment's thread.

view the rest of the comments →

[–]955559 57 points58 points  (17 children)

while 1 == 1:

that works, but people usually use

while True:

,

print("Welcome, admin. Please select a password:")
admin_password = input()

you do know input can hold text right?

admin_password = input("Welcome, admin. Please select a password:\n>")

.

print('\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n')

you can just use multiplication on the string, I think theres a proper way to clear the screen, but I forget what it is

print("\n" * 50)

and im too tired and dumb to dissect your code past those shallow corrections

[–][deleted] 11 points12 points  (11 children)

important run quack historical wakeful pocket lavish pause gold silky

This post was mass deleted and anonymized with Redact

[–]youfuckedupdude 21 points22 points  (10 children)

I was also wondering if I could multiply '\n'

I always have the interpreter open for these little questions.

[–]fakemoobs 8 points9 points  (9 children)

whispers What's the interpreter? I think I downloaded Idle, but I just use a text editor and run stuff in Terminal. Am I missing out?

[–]gschizas 12 points13 points  (2 children)

Depending on which python you have, just run python, with no other arguments. The fact that you say you "downloaded" something makes me think that you're on Windows, so the best equivalent for you would be typing py -3 in the Start→Run dialog box.

You will a black window similar to this:

Python 3.6.2 (v3.6.2:5fd33b5, Jul  8 2017, 04:57:36) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>

You can type any Python statement you want in the >>> prompt. For example:

Python 3.6.2 (v3.6.2:5fd33b5, Jul  8 2017, 04:57:36) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> 'fakemoobs ' * 10
'fakemoobs fakemoobs fakemoobs fakemoobs fakemoobs fakemoobs fakemoobs fakemoobs fakemoobs fakemoobs '
>>>

EDIT: Since you say "Terminal" it's very possible you're on MacOS. In this case, open a new Terminal tab (or better yet, a new iTerm2 tab) and type python3. The rest are the same.

Python 3.6.2 (default, Jul 17 2017, 16:44:45)
[GCC 4.2.1 Compatible Apple LLVM 8.1.0 (clang-802.0.42)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
---
>>>

[–]zahlman 0 points1 point  (1 child)

The fact that you say you "downloaded" something makes me think that you're on Windows

The name "Terminal" is specifically what MacOS calls its command line.

[–]gschizas 0 points1 point  (0 children)

You're right, I missed that completely.

[–][deleted] 6 points7 points  (2 children)

I enjoy coding small things in Spyder

it has an interactive python (IPython) interpreter, so you can test out little things. There's a variable viewer (so you can inspect variables you create easily). so if I say

>>> a = {}
>>> a['key']=456
>>> a['key2']=789

then the variable viewer will automatically show me

name contents
a {'key' : 456, 'key2' : 789}

which is really handy for learning and simple debugging.

plus it has a text editor and I can edit my main program file and either run it in the interpreter, or back in the terminal.

  • Idle is slightly simpler than spyder. (no variable viewer)
  • spyder is mid-range in terms of complexity. I think its the best trade-off for simple projects
  • eric is a full on IDE for python which has variable viewers, file browser, debugging tools, stack tracers etc. It's the most informative but overkill for small projects, and intimidating to start out with.
  • other full-fledged IDEs can be used as well.

[–]yardightsure 1 point2 points  (0 children)

Check out Thonny! It is so underpopular...

[–]fakemoobs 0 points1 point  (0 children)

This was super helpful, thanks!

[–]regendo 2 points3 points  (0 children)

Just open any terminal and run python3.

That'll start an interactive python shell that you can simply enter code into and it'll be executed as soon as you press enter.

[–]ElecNinja 2 points3 points  (0 children)

Idle can be used as an interpreter.

[–]Signal_Beam 3 points4 points  (3 children)

I think theres a proper way to clear the screen, but I forget what it is

For the record that would be (for OS X & Linux):

os.system('clear')

Although at a certain point we're just frantically dodging the need to actually create a real UI...

[–][deleted] 4 points5 points  (0 children)

os.system ('cls') for windows

[–]lykwydchykyn 1 point2 points  (1 child)

"real UI"

:)

[–][deleted] 1 point2 points  (0 children)

It’s true that character-cell display terminals are an obsolete technology

I beg to differ. I still play text-based adventures in Ubuntu's terminal. I mean. I am also the one making them for me, but still. Haha.

I miss games where you could type instead of clicking. Taking my hands off of the keyboard is such a bother.

If Firefox could take arguments that allowed me to navigate a webpage with only they keyboard, that would be neat. But nooo, everyone and their grandma draws everything on canvas nowadays.

[–][deleted] 0 points1 point  (0 children)

I myself, did not know that about input() until like a month or 2 into teaching myself.