[Python] why is my imported function not running in my main file in python [closed]

Discussão em 'Python' iniciado por Stack, Outubro 6, 2024.

  1. Stack

    Stack Membro Participativo

    i am making a showcase of all my python programs from different files and i don't want to move all the code into the main file.

    I tried importing the function from the file in visual studio code but all it did when i called it is

    0 to stop
    1 for settings
    2 for calculator
    3 for number game
    4 for palindrome detector
    5 for pig latin translator
    6 for anagram maker
    7 for averager
    8 for temperature calculator
    9 for area calculator
    what do you want: 1
    ➜ showcase-projects git:(main)


    then i tried just importing the file itself without the function and got the same result. a example of a bit of my code in my main file is:

    from addition import add
    addition()


    for the adder the code is:

    def addition():
    input("what is the first addition: ")
    input("what is the second addition: ")
    print(a+b)

    Continue reading...

Compartilhe esta Página