Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

program to find even numbers in python

m = int(input("Enter number"))
if m % 2 == 0:
    print(m,"is an even number")
else:
    print(m,"is an odd number")

    
Comment

how to detect an even number in python

mynumber = int(input("Enter number")) # Ask an integer number to the user
if mynumber % 2 == 0: # % = modelo, It is equal to the rest of the division
  print(mynumber, "is an even number")
else: # The rest of 7 / 2 is 2.5, not 0
  print(mynumber, "is an odd number")
Comment

Even numbers in Python

count1 = 0
for even_number in range(1, 20):
    if even_number % 2 == 0:
        count1 += 1
        print(even_number)
print(f"we have {count1} even numbers")
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 :: how to import and use keyboard with pygame 
Python :: parallel loops in python 
Python :: python open directory and read files 
Python :: assosciate keys as list to values in python 
Python :: stutter function in python 
Python :: change key of dictionary python 
Python :: pandas reset index from 0 
Python :: _set in django 
Python :: Python connect to a server via RDP 
Python :: python3 check if object has attribute 
Python :: how to check if a variable in python is a specific data type 
Python :: python plot label value 
Python :: hugingface ner 
Python :: access myultiple dict values with list pythojn 
Python :: getsizeof python 
Python :: django pagination rest framework 
Python :: 2d arrays using python numpy 
Python :: Dice roll and coin flip 
Python :: iterate a list of tuples 
Python :: python autoclicker 
Python :: how to make a numpy array of certain values 
Python :: print labels on confusion_matrix 
Python :: how to click a div element in selenium python 
Python :: raspistill timelapse 
Python :: cos inverse in python numpy 
Python :: python print function 
Python :: python check for alphanumeric characters 
Python :: conda enviroment python version 
Python :: read an excel file 
Python :: get vowels from string python 
ADD CONTENT
Topic
Content
Source link
Name
9+5 =