MSK Technologies

Home
Practice Programs
Java Programs Python Programs Java Quiz
Pages
Python Java Material PLSQL Material
Search A Job

Write a python program to merge nested lists ?

  1. Home
  2. Python Programs

Write a python program to merge nested lists ?

Write a python program to merge nested lists ?

Program
def myfun():
    nested_list = [[2, 4, 6],[8, 10, 12, 14]]
    new_list = sum(nested_list,[])
    print(new_list)
if __name__=="__main__":
    myfun()


Output:

[2, 4, 6, 8, 10, 12, 14]


Using reduce function
from functools import reduce
def myfun():
    nested_list = [[2, 4, 6],[8, 10, 12, 14]]
    new_list = reduce(lambda x, y: x+y, nested_list)
    print(new_list)
                 
if __name__=="__main__":
    myfun()


Output:

[2, 4, 6, 8, 10, 12, 14]



More Questions


54 . Write a python program to checking if a string is empty or not ?
55 . Write a python program to merge nested lists ?
56 . Write a python program to Checking if a File Exists or Not ?
57 . Write a python program to convert uppercase strings and we want to convert them into lowercase strings and remove duplicates ?
58 . Write a python program to display list of numbers and we want to return all the numbers from the list that are divisible by 2 and remove duplicates at the same time.
59 . Write a python program to calculate average using python *args ?
60 . Write a Python program to find the area of a triangle.
61 . Write a Python program to convert kilometers to miles.
62 . Write a Python program to convert Celsius to Fahrenheit.
63 . Write a Python Program to Check if a Number is Positive, Negative or Zero.
64 . Write a Python Program to Check if a Number is Odd or Even.



For latest job updates join Telegram Channel: https://t.me/sateeshm

Interview Questions

Java Interview Questions

Python Interview Questions

Oracle Interview Questions

100 Most Asked Java Interview Questions and Answers

HR Interview Questions and Answers

Top 50 OOPS Interview Questions & Answers

Apply For The Job

Apply For Job

Java Material

Python Material

PLSQL Material

.Net Material

Java Practice Programs

400 Java Programs

Java Practice Programs

Write a Java program that takes two numbers and display the product of two numbers

Write a Java program to count the number of even and odd elements in a given array

Write a Java program to convert a string to an integer

Write a java Program to print palindrome number upto N numbers

Write a Java program to compute the square root of an given integer

Python Practice Programs

Write a Python program to count number of vowels in the given string

Write a python program to Find the index of the largest number in the list

Write a Python Program to Make a Simple Calculator with 4 basic mathematical operations.

Write a Python program to print fibonacci series

Write a Python Program to Find the Sum of Natural Numbers.

Java Quiz

Java Quiz - 20

Java Quiz - 7

Java Quiz - 12

Java Quiz - 1

Java Quiz - 19

Courses
Java Python PLSQL .Net ADO.Net About Us
Quick Links
Daily Use English Sentences Daily General Knowledge General Knowledge Latest Update Inventions and Inventors జనరల్ నాలెడ్జ్ General Knowledge Spoken English Spoken Hindi GK Hindi Telugu Facts Unknown Facts Psychology Facts Motivation Quotes విటమిన్ - సి,డి,ఇ,కె Android
Spiritual
రాధాకృష్ణ భగవద్గీత Motivation Quotes Slokas Talapatra Nidhi ఆధ్యాత్మిక భక్తి ప్రపంచం Sadhguru Sai Motivation Quotes గౌతమ బుద్ధుడు Bhagavad Gita Quotes
New Updates
MSK Technologies
© sateeshm, All Right Reserved. Designed By sateeshm
Home Help FQAs