diff --git a/notes.py b/notes.py index 019e09f..c9a4674 100755 --- a/notes.py +++ b/notes.py @@ -30,8 +30,9 @@ def note2freq(name): return A*rel**(fullnum + 3) if __name__ == '__main__': + test_fmt = '{:3} gave {: 9.2f} Hz\nexpected {: 9.2f} Hz' def test(name, expected): - print('{:3} gave {: 9.2f} Hz\nexpected {: 9.2f} Hz'.format(name, note2freq(name), expected)) + print(test_fmt.format(name, note2freq(name), expected)) test('C2' , 65.41) test('Ab4', 415.30) diff --git a/strings.py b/strings.py index b3e7704..978ad11 100755 --- a/strings.py +++ b/strings.py @@ -16,8 +16,8 @@ def uw2tension(uw, freq, SL): def tension2uw(t, freq, SL): return (t*uw_const)/(2*SL*freq)**2 -outfmt = '{:<8} at {:> 5.2f} lbs ({:>+4.2f})' -finalfmt = 'total: {:>7.2f} lbs ({:>+5.2f})' +outfmt = '{:<8} at {:> 5.2f} lb ({:>+4.2f})' +finalfmt = 'total: {:>7.2f} lb ({:>+5.2f})' def print_ideal_stock(strings, scale_length=25.512): SL = scale_length total_tension = 0