Mega Code Archive

 
Categories / Python / Language Basics
 

If-elif-else structure

import random mood = random.randrange(3) if mood == 0:     print mood elif mood == 2:     print mood else:     print "Illegal mood value!."