Computer Science, asked by dhilshas000, 4 months ago

write a program to increment to the elements of list accepted from the user 5(for example if list is [1,2,3,4,5] then resultant list should be [6,7,8,9,10]) ​

Answers

Answered by valeriy69
1

\large\mathsf\color{pink}{Solution\: using\: python\: 3}

nums = [int(n) + 5 for n in input("enter nums: ").split()]

print(nums)

\large\mathsf\color{lightgreen}useful?\: \color{white}\longrightarrow\: \color{orange}brainliest!

Answered by Pakiki
0

9. Lists¶

A list is an ordered set of values, where each value is identified by an index. The values that make up a list are called its elements. Lists are similar to strings, which are ordered sets of characters, except that the elements of a list can have any type. Lists and strings — and other things that behave like ordered sets — are called sequences.

9.1. List values

There are several ways to create a new list; the simplest is to enclose the elements in square brackets ( [ and ]):

[10, 20, 30, 40]

["spam", "bungee", "swallow"]

The first example is a list of four integers. The second is a list of three strings. The elements of a list don’t have to be the same type. The following list contains a string, a float, an integer, and (mirabile dictu) another list:

["hello", 2.0, 5, [10, 20]]

A list within another list is said to be nested.

Finally, there is a special list that contains no elements. It is called the empty list, and is denoted [].

Like numeric 0 values and the empty string, the empty list is false in a boolean expression:

>>> if []:

... print 'This is true.'

... else:

... print 'This is false.'

...

This is false.

>>>

Similar questions