0

NameError: name 'test_nn' is not defined

I am trying to execute the below code- str1 = input('Input string: ') print (str1) print ('ENTER- 1 for Uppper, 2 for Lower, 3 for Swap, 4 for title') try: test_nn = eval(input('Select the operation-')) print(test_nn) except: pass if test_nn == 1: print (str1.upper()) elif test_nn == 2: print (str1.lower()) elif test_nn == 3: print (str1.swapcase()) elif test_nn == 4: print (str1.title()) else : print ('Select the Correct Option') but an error occurs i.e. EOF when reading a line Traceback (most recent call last): File "./Playground/file0.py", line 10, in <module> if n == 1: NameError: name 'n' is not defined!!! "Any help is welcomed'

7th Oct 2020, 8:13 PM
Ajay Gaur
Ajay Gaur - avatar
2 Answers
+ 1
put in first line: test_nn=""
7th Oct 2020, 8:17 PM
Shadoff
Shadoff - avatar
0
This code tells you how to deal with SoloLearn input... It need to give all input at once by line by line in python separating in Sololearn.. Kindly run this program.. https://code.sololearn.com/WhiNb9BkJUVC/?ref=app
7th Oct 2020, 8:29 PM
Jayakrishna 🇮🇳