python_fn_16 - 8BitsCoding/RobotMentor GitHub Wiki

python

def a3():
    print('aaa')
a3()
def a3():
    return 'aaa'
print(a3())
def a(num):
    return 'a'*num
print(a(3))
def make_string(str, num):
    return str*num
print(make_string('b', 3))
input_id = input("아이디를 입력해주세요.\n")
def login(_id):
    members = ['egoing', 'k8805', 'leezche']
    for member in members:
        if member == _id:
            return True
    return False
if login(input_id):
    print('Hello, '+input_id)
else:
    print('Who are you?')

ruby

def a3()
    puts('aaa')
end
a3()
def a3()
    return 'aaa'
end
puts(a3())
def a(num)
    return 'a'*num
end
puts(a(3))
def make_string(str, num)
    return str*num
end
puts(make_string('b', 3))
puts("아이디를 입력해주세요")
input_id = gets.chomp()
 
def login(_id)
  members = ['egoing', 'k8805', 'leezche']
  for member in members do
      if member == _id
          return true
      end
  end
  return false
end
 
if login(input_id)
  puts('Hello, '+input_id)
else
  puts('Who are you?')
end