0

Is there a difference between these two, besides length?

Ignore the mistakes in the code please. I'm new. What I would like to know is, why should I choose one over the other. They both do the same thing in the Terminal, but I'm interested in more info regarding which of the two should I choose, and why.

password = 'Smith'
user = 'John'
'print('\nWelcome to XXX, SSH Server\n')'

iLogin = input('Enter your Username: ')
iPass = input('Enter your Password: ')

if iPass == password and iLogin == user:
    print('\nWelcome Mr. Smith')
else:
    print('\nHello Random Citizen')

I get the fact that both are doing the same thing in the end, but I'm interested if there is a time to use either of the two. I know that return and print differ in regard to how the computer uses or makes use of a particular code, but are there anymore reasons that I should chose one over the other?

password = 'Smith'
user = 'John'
iLogin = ''
iPass = ''

def display_Welcome():
    print('\nWelcome to XXX, SSH Server\n')

def User_Login():
    return input('Enter your Username: ')

def User_Pass():
    return input('Enter your Password: ')

def pass_check(user, passwrd):
    if iPass == password and iLogin == user:
        return ('\nWelcome Mr. Smith')
    else:
        return ('\nHello Random Citizen')

iLogin = User_Login()
iPass = User_Pass()
Jack
  • 1
  • 3
  • Check indentation on second code block. – eNc Jun 20 '20 at 04:41
  • Ignore the mistakes in the code please. I'm new. What I would like to know is, why should I choose one over the other. They both do the same thing in the Terminal, but I'm interested in more info regarding which of the two should I choose, and why. – Jack Jun 21 '20 at 00:23

0 Answers0