Python - Statement if elif

Introduction

if statement, with all its optional parts present:

Demo

x = 'abcd' 
if x == 'r': 
    print("r") 
elif x == 'b': 
    print("b") 
else: # from   w  w  w .j a  va  2s .c o  m
    print('else!')

Result

Related Topic