Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

If elif else

number = 9

if number < 5: # Condition 1
	print("Less than 5") # Code 1
elif number < 10: # Condition 2
	print("Less than 10") # Code 2
else: # If Condition 1 and 2 are not true
	print("Not less than 5 or 10") # Code 3
Comment

if elif and else in python

var_one = input("Give me a number: ")
var_one = int(var_one)
var_two = input("Give me another number: ")
var_two = int(var_two)

if var_one > var_two:
    print(f"First number, {var_one} is bigger")
elif var_one < var_two:
    print(f"Second number, {var_two} is bigger")
else:
    print(f"Both numbers are the same : {var_one}")
Comment

PREVIOUS NEXT
Code Example
Python :: scaling pkl file? 
Python :: scipy check normal distribution 
Python :: save image to database using pillow django 
Python :: plotly coordinates mapping 
Python :: pytorch cuda tensor in module 
Python :: file open in python 
Python :: upload file to aws 
Python :: python generate html 
Python :: Word2Vec 4.0 Gensim model python dataframe 
Python :: assertionerror-accepted-renderer-not-set-on-response-in-django 
Python :: python redirect with button click 
Python :: unsplash python 
Python :: eval function in python 
Python :: composition in python 
Python :: python min value index from an array 
Python :: turtle graphics documentation|pensize 
Python :: re python3 
Python :: python beautifulsoup get option tag value 
Python :: how to read json from python 
Python :: pyspark read from redshift 
Python :: append 1 colimn in pandas df 
Python :: how to print during multiprocessing 
Python :: # enumerate 
Python :: python multiply string 
Python :: torch print full tensor 
Python :: join python documentation 
Python :: string list to int list python 
Python :: python web framework 
Python :: convert dictionary keys to list python 
Python :: how to negate a boolean python 
ADD CONTENT
Topic
Content
Source link
Name
3+2 =