Search code examples
pythonfunctionprintingcommandline

Pyhon didn't show on console a function


I have this function in python:

def Alex():
        print ("Numele si prenumele: Alex Popescu.")
        print ("Varsta: 27 ani.")
        print ("Salariu: €1750 ")
        print ("Post: Tirist.")

if __name__ == '__main__':
        Alex()

When I'm calling the function, python doesn't print the function CODE AND COMMAND LINE


Solution

  • Value returned by input is always string even if someone type only digits like '1'.

    actiune = input('Ce actiune doriti sa faceti?(1-4): ')
    
    if actiune == '1':
        def Alex():
            print ("Numele si prenumele: Alex Popescu.")
            print ("Varsta: 27 ani.")
            print ("Salariu: €1750 ")
            print ("Post: Tirist.")
        if __name__ == '__main__':
            Alex()