Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

Python program to print odd numbers in a List

# Python program to print odd Numbers in a List
  
# list of numbers
list1 = [10, 21, 4, 45, 66, 93]
  
# iterating each number in list
for num in list1:
      
    # checking condition
    if num % 2 != 0:
       print(num, end = " ")
Comment

python print odd numberrs

# Python program to print all ODD numbers in the range[a, b]
a, b = (7, 19)

for num in range(a, b+1): # b+1 is to include b itself
  if num & 1:
    print(num, end = ' ')
# output:
# 7 9 11 13 15 17 19
Comment

how to print even numbers in python

# Python program to print Even Numbers in given range
  
start, end = 0, 50
  
# iterating each number in list
for num in range(start, end + 1):
      
    # checking condition
    if num % 2 == 0:
        print(num, end = " ")
Comment

odd number in python

for tc in range(int(input())):
    a,b = map(int,input().split())
    x =  b//2 + (b%2)
    y =  a//2
    print("Case %d: %d"%(tc+1,x*x-y*y))
    
"""
Input:
2
1 10
2 10
Output:
Case 1: 25
Case 2: 24
"""
Comment

PREVIOUS NEXT
Code Example
Python :: tkinter how to remove button boder 
Python :: flask port 
Python :: python add field to dictionary 
Python :: Python program to draw star 
Python :: creating a pandas df 
Python :: clone website in python 
Python :: python dict to dataclass 
Python :: python dictionary rename key 
Python :: how to display csv in pandas 
Python :: how to use global variable in python 
Python :: how to remove all 2 in a list python 
Python :: python read text file next line 
Python :: delete virtual environment in python windows 
Python :: max of three numbers in python 
Python :: progressbar time in python 
Python :: socket io python 
Python :: python find directory of file 
Python :: python isnan 
Python :: create log in python 
Python :: how to merge two dictionaries in python 
Python :: scipy cosine distance 
Python :: pdf to csv python 
Python :: Write a Python program to count the number of lines in a text file. 
Python :: generate random token or id in django 
Python :: python import from parent directory 
Python :: get the length of an array python 
Python :: how to get input from user in python with out press enter 
Python :: tensorflow keras load model 
Python :: swagger library for django 
Python :: python dict for k v 
ADD CONTENT
Topic
Content
Source link
Name
6+5 =