1

I have this program:

import display
a = int(input('1st number:'))
b = int(input('2nd number:'))
c = a + b
display.display1

and the other with the name 'display':

def display1():
    print(c)

It will come out :

NameError: name 'c' is not defined

how do I define the 'c' to find the total for a and b?. Thanks

Joe han
  • 173
  • 10

2 Answers2

1

You need to pass the parameter c to the function display1.

So your display1 function should be like as follows

def display1(c):
    print(c)

And while calling you need to give c to display1 function as a parameter as follows

display.display1(c)
cengineer
  • 1,242
  • 1
  • 12
  • 17
1
import display
a = int(input('1st number:'))
b = int(input('2nd number:'))
c = a + b
display.display1(c)

.

def display1(c):
    print(c)
Alaa Aqeel
  • 508
  • 7
  • 15