jeudi 24 novembre 2016

Is it bad to have other If statements inside an if statements in python

The closest question I found about this was "multiple if statements in one if statements in python?" While similar title it is NOT the same question because based on the response "have_umbrella" will or will not be executed.

Is it bad code to have an if statement inside another if statement?

  if is_it_raining == 'Yes':
    have_umbrella = input('Do you have an umbrella?')
    umbrella_check(have_umbrella)

  elif is_it_raining == 'No':
    print('Go outside end')
    print('End')

I called a function "umbrella_check" which is basically just another if statement. Is this correct or is it fine to full on write another if statement inside that if statement?

Aucun commentaire:

Enregistrer un commentaire