def func_eleven(calc_cleaned, molar_mass): calc = analyze_what_calc(calc_cleaned) if calc == 'g': moles = how_many_moles() formatted_moles = format_moles(moles) float_bool_value = confirm_float_moles(formatted_moles) while float_bool_value == False: bool_not_float = handle_not_float(formatted_moles) if bool_not_float == True: sys.exit() else: print("I'm sorry, but you did not enter a floating-point \ value. Please try again." + '\n') moles = how_many_moles() formatted_moles = format_moles(moles) float_bool_value = confirm_float_moles(formatted_moles) continue moles = make_moles_float(moles) grams = moles_to_grams(moles, molar_mass) answer = str(grams) + ' ' + 'g' print('\n') print("You have " + answer + '\n') elif calc == 'm': grams = how_many_grams() formatted_grams = format_grams(grams) float_bool_value = confirm_float_grams(formatted_grams) while float_bool_value == False: bool_not_float = handle_not_float(formatted_grams) if bool_not_float == True: sys.exit() else: print("I'm sorry, but you did not enter a floating-point \ value. Please try again." + '\n') grams = how_many_grams() formatted_grams = format_grams(grams) float_bool_value = confirm_float_grams(formatted_grams) continue grams = make_grams_float(grams) moles = grams_to_moles(grams, molar_mass) answer = str(moles) + ' ' + 'mol' print('\n') print("You have " + answer + '\n')
def func_eleven(calc_cleaned, molar_mass): calc = analyze_what_calc(calc_cleaned) if calc == 'g': moles = how_many_moles() formatted_moles = format_moles(moles) float_bool_value = confirm_float_moles(formatted_moles) while float_bool_value == False: bool_not_float = handle_not_float(formatted_moles) if bool_not_float == True: sys.exit() else: print("I'm sorry, but you did not enter a floating-point \ value. Please try again." + '\n') moles = how_many_moles() formatted_moles = format_moles(moles) float_bool_value = confirm_float_moles(formatted_moles) continue moles = make_moles_float(moles) grams = moles_to_grams(moles,molar_mass) answer = str(grams) + ' ' + 'g' print('\n') print("You have " + answer + '\n') elif calc == 'm': grams = how_many_grams() formatted_grams = format_grams(grams) float_bool_value = confirm_float_grams(formatted_grams) while float_bool_value == False: bool_not_float = handle_not_float(formatted_grams) if bool_not_float == True: sys.exit() else: print("I'm sorry, but you did not enter a floating-point \ value. Please try again." + '\n') grams = how_many_grams() formatted_grams= format_grams(grams) float_bool_value = confirm_float_grams(formatted_grams) continue grams = make_grams_float(grams) moles = grams_to_moles(grams,molar_mass) answer = str(moles) + ' ' + 'mol' print('\n') print("You have " + answer + '\n')
def test_two(self): self.assertEqual(make_grams_float('69'), 69)
def test_one(self): self.assertEqual(make_grams_float('4.3242'), 4.3242)
def test_two(self): self.assertEqual(make_grams_float('69'),69)
def test_one(self): self.assertEqual(make_grams_float('4.3242'),4.3242)