-1
services_array = []
passwords_array = []

def main_program():

    user_service = input("Il nome del servizio è: ")
    services_array = [user_service]

    user_password = input("Inserisci la password: ")
    passwords_array = [user_password]


def show_inputs(services_array, passwords_array):
    for services in services_array:
       for passwords in passwords_array:
           print (services + " --------- "+ passwords)

main_program()
show_inputs(services_array, passwords_array)

I'm new to python and I'm using Pycharm to write my code. I just started writing this password manager and when i run it I have some problems: 1. It does not print out your inputs 2. It closes right after you insert your inputs They could sound so stupid to you guys but since I'm not an expert coder, I'm struggling resolving them. Hope you can help me. Thanks!

B.Soflau
  • 5
  • 2
  • 1
    There's nothing left to do after taking inputs and printing them, so of course the program closes. Why shouldn't it close? – Aran-Fey Apr 25 '18 at 07:11
  • is there a way to stop this? I mean I dont want it to close – B.Soflau Apr 25 '18 at 07:14
  • Are you asking because you don't want the _terminal_ to close in which the program is running? There's no reason to keep the _program_ itself running, is there? – Aran-Fey Apr 25 '18 at 07:15
  • It's supposed to be a password manager so after you input the service and the password you should be able to see them so I dont want the terminal t o close instantly – B.Soflau Apr 25 '18 at 07:17
  • Well, I guess you can just add `input()` at the end of the code. That'll make it stay open until the user presses Return. – Aran-Fey Apr 25 '18 at 07:18

1 Answers1

0

Try to use append

services_array = []
passwords_array = []

def main_program():

    user_service = input("Il nome del servizio è: ")
    services_array.append(user_service)

    user_password = input("Inserisci la password: ")
    passwords_array .append(user_password)


def show_inputs(services_array, passwords_array):
    for services in services_array:
       for passwords in passwords_array:
           print (services + " --------- "+ passwords)

main_program()
show_inputs(services_array, passwords_array)
bereal
  • 32,519
  • 6
  • 58
  • 104