Nov-06-2018, 08:51 AM
The issue I am having is that when I input a number [1-3] It is accepted but I can not get it to be viewed as a variable.
So it will print "Line_2" but it will not activate "Line_2" and print "Choice_B" which is what I need it to do.
Now this of course just a test script for a much bigger script, but It is failing just the same way.
If I replace [print(Line_2)] then the output is"Choice_B" as it should be. So I must be missing a conversion in the variables.
Any help with this would be much appreciated.
So it will print "Line_2" but it will not activate "Line_2" and print "Choice_B" which is what I need it to do.
Now this of course just a test script for a much bigger script, but It is failing just the same way.
If I replace [print(Line_2)] then the output is"Choice_B" as it should be. So I must be missing a conversion in the variables.
Any help with this would be much appreciated.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
Line_1 = "Choice_C" # I would like to choose one of these lines Line_2 = "Choice_B" # I would like to choose one of these lines Line_3 = "Choice_A" # I would like to choose one of these lines line = input ( "pick a line number:" ) # I would enter the number 1-3 line = int (line) # I wastrying to change this to an interger. print ( "line_" + str (line)) # then I tried changeing it to a string. # This is the output when running pick a line number: 2 line_2 The issue is I need the printed output to say: Choice_B When I select number 2. |