bootcamp_python icon indicating copy to clipboard operation
bootcamp_python copied to clipboard

Python 01 ex05

Open Mazoise opened this issue 3 years ago • 1 comments

  • Day: 01
  • Exercise: 05

Dans les tests qui sont donnés avec le sujet (banking_test1.py && banking_test2.py), l'output c'est "Failed" si on valide l'exercice. Ça prète à confusion.

Dans le test1 le compte est corrompu donc au lieu de ça :

    if bank.transfer('William John', 'Smith Jane', 545.0) is False:
        print('Failed')
    else:
        print('Success')

ce serait mieux de mettre :

    if bank.transfer('William John', 'Smith Jane', 545.0) is False:
        print('Success : The bank transfer failed since the accounts were corrupted')
    else:
        print('Fail : The bank transfer was made even though the accounts were corrupted')

et pour le test2 :

    if bank.transfer('William John', 'Smith Jane', 1000.0) is False:
        print('Success : The bank transfer failed since the accounts were corrupted')

        bank.fix_account('William John')
        bank.fix_account('Smith Jane')

        if bank.transfer('William John', 'Smith Jane', 1000.0) is False:
            print('Fail : The bank transfer failed even though the accounts should have been fixed')    
        else:
            print('Success : The bank transfer was made since the accounts were properly fixed')
    else:
        print('Fail : The bank transfer was made even though the accounts were corrupted')

Mazoise avatar May 08 '22 09:05 Mazoise

les deux peuvent porter a confusion, je met ca comme enhancment

qfeuilla avatar May 19 '22 17:05 qfeuilla