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 print Nsmallest numbers

  1. Home
  2. Python Programs

Write a python program to print Nsmallest numbers

Write a python program to print Nsmallest numbers

Program
import heapq
def myfun():
    list1 = [12, 34, 67, 98, 90, 68, 55, 54, 64, 35]
    list2= heapq.nsmallest(5, list1)
    print(list2)

if __name__=="__main__":
    myfun()



Output:

[12, 34, 35, 54, 55]



More Questions


41 . Write a python program to print Nsmallest numbers
42 . Write a python program to check two strings are Anagram or not
43 . Write a python program to checking internet speed
44 . Write a python program to print reserved keywords
45 . Write a python program to print properties and methods
46 . Write a python program to open a website using python
47 . Write a python program to print most frequent letter in a string
48 . Write a python program to check memory sizes of list ,set ,tuple
49 . How do you confirm if an object is iterable using code?
50 . Write a python program to sort list with sorted & lambda
51 . Write a python program to access news using python



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

Add all the digits of a given positive integer until the result has a single digit

Write a Java program to swap two variables

Write a java Program to check the given number is Palindrome or not

Write a Java program to compare two numbers

Write a Java program that accepts an integer (n) and computes the value of n+nn+nnn

Python Practice Programs

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

Write a Python program that calculates the area of a circle based on the radius entered by the user.

Write a Python Program to Check if a Number is Positive, Negative or Zero.

Write a Python program that checks whether a specified value is contained within a group of values.

Write a Python Program to Find LCM.

Java Quiz

Java Quiz - 10

Java Quiz - 21

Java Quiz - 13

Java Quiz - 16

Java Quiz - 7

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