 # Python program to print odd numbers in a list

Example :

`  Input:  list1 = [2, 7, 5, 64, 14]  Output:  [7, 5]  Input:  list2 = [12, 14, 95, 3, 73]  Output:  [95, 3, 73] `
1. ` # Python program for printing odd numbers in a list `

` `
` # list of numbers `

` list1 ` ` = ` ` [` ` 10 ` `, ` ` 21 ` `, ` ` 4 ` `, 45 , 66 , 93 ] `

```   # iterate over each number in the list for num in list1:    # check status if num % 2 ! = 0 : print (num, end = "" ) ```

` `

Exit :

` 21 45 93 `
2. ` # Python program for printing odd numbers in a list `

` `
` # list numbers `

` list1 ` ` = ` ` [ 10 , 21 , 4 , 45 , 66 , 93 ] `

``` num = 0   # using a while loop while (num & lt;  len (list1)):   # check status if num % 2 ! = 0 : print (list1 [num], end = "" )   # increment number   num + =   1   ```

` `

Exit :

` 21 45 93 `
3. ` # Python program for printing odd numbers in a list `

` # list of numbers `

``` list1 = [ 10 , 21 , 4 , 45 , 66 , 93 ]   only_odd = [num for num in list1 if num % 2 = = 1 ]    print (only_odd) Exit : 21 45 93 ```
4. ``` `````` # Python program for printing odd numbers in a list   # list of numbers list1 = [ 10 , 21 , 4 , 45 , 66 , 93 , 11 ]      # we can also print odd numbers using lambda expressions. odd_nos = list ( filter ( lambda x: (x % 2 ! = 0 ), list1))    print ( "Odd numbers in the list:" , odd_nos)  Exit: Odd numbers in the list: [21, 45, 93, 11] ```
``` ```
``` ```
``` ```
``` ```
``` (adsbygoogle = window.adsbygoogle || []).push({}); © 2021 Python.Engineering Best Python tutorials books for beginners and professionals Become an author and write for us Architect Development For dummies Machine Learning Analysis Loops Counters NumPy NLP Regular Expressions File Handling Arrays String Variables Knowledge Database X Submit new EBook \$(document).ready(function () { \$(".modal_galery").owlCarousel({ items: 1, itemsCustom: false, itemsDesktop: [1300, 1], itemsDesktopSmall: [960, 1], itemsTablet: [768, 1], itemsTabletSmall: false, itemsMobile: [479, 1], singleItem: false, itemsScaleUp: false, pagination: false, navigation: true, rewindNav: true, autoPlay: true, stopOnHover: true, navigationText: [ "<img class='img_no_nav_mob' src='/wp-content/themes/nimani/image/prevCopy.png'>", "<img class='img_no_nav_mob' src='/wp-content/themes/nimani/image/nextCopy.png'>" ], }); \$(".tel_mask").mask("+9(999) 999-99-99"); }) ```