Computer Science, asked by Veer9080, 10 months ago

Determine what is printed by the following program listinput.py,
list1 = eval(raw_input(‘Give a list:’))
list2 = eval(raw_input(‘Give another list:’))
print list1 + list2
When the program is running as follows:
Unix/DOS > python listinput.py
Give a list: ‘[1,2]’
Give another list: "[3,4]"

Answers

Answered by abhilashbhoi16
2

Explanation:

The syntax is as follows for Python v2.x:

mydata = raw_input('Prompt :')

print (mydata)

The syntax is as follows for Python v3.x as raw_input() was renamed to input() :

mydata = input('Prompt :')

print (mydata)

In the above example, a string called mydata stores users data. Please note that if you want to compare mydata

Answered by Anonymous
0

The following program will print [1, 2][3,4].

  • The program is the Pythin language program
  • The program is using eval(s). Eval(s) evaluates any expression which is contained in the string s and hence returns a resulting object.
  • In the given program, both the inputs are strings. A symbol ( + ) between the strings means to concatenate the strings, that is setting the second string right after the first one.
  • Thus, as a result the program will execute [1, 2][3,4].
Similar questions