Computer Science, asked by upendra4069, 4 months ago

. Take 10 integer inputs from user and store them in a list. Now, copy all the elements in another list but in reverse order.

using python program

Answers

Answered by valeriy69
5

integers = input("Enter ten integers: ").split()

reversed_integers = integers[::-1]

print(reversed_integers)

\footnotesize\underline\mathsf\color{yellow}{Choose\: brainliest\: if\: it\: helped.}

Answered by tripathiakshita48
0

Here's a Python program that takes 10 integer inputs from the user and stores them in a list. Then it copies all the elements in another list but in reverse order:

# Taking 10 integer inputs from user and storing them in a list

input_list = []

for

i

in

range

(

10

):

   input_num =

int

(

input

(

"Enter an integer: "

))

   input_list.append(input_num)

# Copying all the elements in another list but in reverse order

reverse_list = input_list[::-

1

]

# Printing both the lists

print

(

"Original list:"

, input_list)

print

(

"Reverse list:"

, reverse_list)

OUTPUT

Enter an integer:

1

Enter an integer:

2

Enter an integer:

3

Enter an integer:

4

Enter an integer:

5

Enter an integer:

6

Enter an integer:

7

Enter an integer:

8

Enter an integer:

9

Enter an integer:

10

Original list:

[

1

,

2

,

3

,

4

,

5

,

6

,

7

,

8

,

9

,

10

]

Reverse list:

[

10

,

9

,

8

,

7

,

6

,

5

,

4

,

3

,

2

,

1

]

In the above program, we first take 10 integer inputs from the user using a for loop and append them to an empty list called "input_list". Then, we use slicing to copy all the elements of "input_list" in reverse order and store them in another list called "reverse_list". Finally, we print both the lists using the "print()" function.

for more such questions on python
https://brainly.in/question/16086632
#SPJ3

Similar questions