Finance[US] Career Guide Free Tutorials Go to Your University Placement Preparation 
0 like 0 dislike
546 views
in Python Programming by Goeduhub's Expert (9.3k points)

What are the decision making statements in python? How do you write an IF ELSE statement in Python?

1 Answer

0 like 0 dislike
by Goeduhub's Expert (9.3k points)
selected by
 
Best answer

# Decision making

print ('What would you like to drink?')

print( '1. coffee')

print ('2. tea')

# Take input from user

drink = raw_input("> ")

# If the user has entered '1' enter if conditional statement 

if drink == '1':

print ('What kind of coffee would you like?')

print ('1. Irish')

print ('2. Americano')

coffee = raw_input("> ")

# If the user has entered '1' enter if conditional statement 

if coffee == '1':

print ('Irish coffee served')

elif coffee == '2':

print( 'Americano coffee served')

else:

print ('Any coffee should be fine')

# If the user has entered '2' enter elif conditional statement 

elif drink == '2':

print( 'What kind of tea would you like?')

print ('1. Green tea')

print ('2. Black tea')

tea = raw_input("> ")

if tea == '1':

print ('Green tea served')

elif tea == '2':

print ('Black tea served')

else:

print ('Any tea should be fine')

# If the user has not entered '1' or '2' then enter else conditional statement 

else:

print( 'You have not choosen the right option')

Learn & Improve In-Demand Data Skills Online in this Summer With  These High Quality Courses[Recommended by GOEDUHUB]:-

Best Data Science Online Courses[Lists] on:-

Claim your 10 Days FREE Trial for Pluralsight.

Best Data Science Courses on Datacamp
Best Data Science Courses on Coursera
Best Data Science Courses on Udemy
Best Data Science Courses on Pluralsight
Best Data Science Courses & Microdegrees on Udacity
Best Artificial Intelligence[AI] Courses on Coursera
Best Machine Learning[ML] Courses on Coursera
Best Python Programming Courses on Coursera
Best Artificial Intelligence[AI] Courses on Udemy
Best Python Programming Courses on Udemy

 Important Lists:

Important Lists, Exams & Cutoffs Exams after Graduation PSUs

 Goeduhub:

About Us | Contact Us || Terms & Conditions | Privacy Policy ||  Youtube Channel || Telegram Channel © goeduhub.com Social::   |  | 

 

Free Online Directory

...