Question: 3. Write a Python function concat_list() that accepts a list containing string values and an integer as input and prints out a new list

3. Write a Python function concat_list() that accepts a list containing string values and an integer as input

3. Write a Python function concat_list() that accepts a list containing string values and an integer as input and prints out a new list where each element in the list is concatenated with all integers from 1 to n. You only need to check the following testing case and print out the results as shown below. You can directly assign values to the input list and integer (i.e. no need to use an input() function). The input list is ['a', 'b', 'c', 'd']. The Input Integer is 5. The new list is ['1", "a2', 'at', 'a4', 'as", "b1', 'b2', '63', '64", "b5", "c1', 'c2', 'c3', 'c4', 'cs", "d1", "d2', '3', 'd 4', 'ds']. 4. Write a Python program that accepts a colon-separated sequence of words as input and prints the unique words in sorted form (alphanumerically). 524 Please enter a sequence of words seperated by colons:good:no:yes: hello: da y: good: hello The new sorted list is: ['day', 'good', 'hello', 'no', 'yes'] Please enter a sequence of words seperated by colons:good no yes The sequence is not seperated by colons 5. Step 1: Use list comprehension expression to create a list to include elements that satisfy the following two criteria: (1) All elements are integers between 1 and 20 (inclusive); (2) All elements are not divisible by 3 nor by 5. Print out the list and move to the next step. Step 2: Convert all elements that are divisible by 2 to their opposites (e.g. 2 to -2) and print out the new list (step-2 list). Step 3: Sum up the value of all positive elements in the step-2 list and print out the result. You can use the following format to print out your results. My initial list is: My step-2 list is: The sum of positive elements in my step-2 list is: C EC ANO F

Step by Step Solution

3.44 Rating (160 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Question 3 Heres the Python function concatlist Python def concatlistlist1 n newlist for item ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!