A small problem about define function and assign var

Viewed 25

Yesterday, my teacher give me some homework:

  1. In function main() declare two var num1, num2 with type float
  2. Define function getIn() to assign to 2 var in function main()

My code:

def main():
    num1=float()
    num2=float()
def getIn():
    main()
    num1=input()
    num2=input()

My code doesn't work and I think I wasn't assign value for 2 var in main. I wonder if there is a way to define the type for the variable without entering a value for it? If not what is the solution to my exercise?

0 Answers
Related