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 . ja  va 2s  . c  om
    print('else!')

Result

Related Topic