Nested if demo : For : Language Basics : Python examples (example source code) Organized by topic

C++
PHP
Python
Python Home »  Language Basics   » [  For  ]  Screenshots 
 



Nested if demo




name = raw_input('What is your name? ')

if name.endswith('Yin'):
    if name.startswith('Mr.'):
        print 'Hello, Mr. Yin'
    elif name.startswith('Mrs.'):
        print 'Hello, Mrs. Yin'
    else:
        print 'Hello, Yin'
else:
    print 'Hello, stranger'

           
       
Related examples in the same category
1.  Dictionary for loop Dictionary for loop
2.  For loop demo For loop demo
3.  for with else for with else
4.  Calculating compound interest. Calculating compound interest.
























Home| Contact Us
Copyright 2003 - 04 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.