コード例 #1
0
ファイル: molar_conversion.py プロジェクト: mclement1/csc221
def func_twelve():
    another_calc_dec = another_calc()
    cleaned_calc_dec  = rem_comm_spaces(another_calc_dec)
    alpha_bool_value = is_alpha(cleaned_calc_dec)
    while alpha_bool_value == False:
        print("I'm sorry, but I did not understand that. \
Please try again. " + '\n')
        another_calc_dec = another_calc()
        cleaned_calc_dec = rem_comm_spaces(another_calc_dec)
        alpha_bool_value = is_alpha(cleaned_calc_dec)
        continue
    return another_calc_dec
コード例 #2
0
def func_twelve():
    another_calc_dec = another_calc()
    cleaned_calc_dec = rem_comm_spaces(another_calc_dec)
    alpha_bool_value = is_alpha(cleaned_calc_dec)
    while alpha_bool_value == False:
        print("I'm sorry, but I did not understand that. \
Please try again. " + '\n')
        another_calc_dec = another_calc()
        cleaned_calc_dec = rem_comm_spaces(another_calc_dec)
        alpha_bool_value = is_alpha(cleaned_calc_dec)
        continue
    return another_calc_dec
コード例 #3
0
def func_one():
    elements = get_elements()
    elements_stripped = rem_comm_spaces(elements)
    alpha_only = only_alpha(elements_stripped)
    while alpha_only == False:
        print('\n')
        print("I'm sorry, but you seem to have entered \
a numerical value, invalid punctuation mark, or the empty string. \
Please try again." + '\n')
        elements = get_elements()
        elements_stripped = rem_comm_spaces(elements)
        alpha_only = only_alpha(elements_stripped)
        continue
    return elements
コード例 #4
0
ファイル: molar_conversion.py プロジェクト: mclement1/csc221
def func_one():
    elements = get_elements()
    elements_stripped = rem_comm_spaces(elements)
    alpha_only = only_alpha(elements_stripped)
    while alpha_only == False:
        print('\n')
        print("I'm sorry, but you seem to have entered \
a numerical value, invalid punctuation mark, or the empty string. \
Please try again." + '\n')
        elements = get_elements()
        elements_stripped = rem_comm_spaces(elements)
        alpha_only = only_alpha(elements_stripped)
        continue
    return elements
コード例 #5
0
def func_four():
    numbers = get_numbers()
    numbers_stripped = rem_comm_spaces(numbers)
    num_only = only_num(numbers_stripped)
    while num_only == False:
        numbers = format_input(numbers)
        if numbers == 'quit':
            sys.exit()
        else:
            print("I'm sorry, but you seem to have entered \
a letter, an invalid punctuation mark, or the empty string. \
Please try again." + '\n')
            numbers = get_numbers()
            numbers_stripped = rem_comm_spaces(numbers)
            num_only = only_num(numbers_stripped)
            continue
    return numbers
コード例 #6
0
ファイル: molar_conversion.py プロジェクト: mclement1/csc221
def func_four():
    numbers = get_numbers()
    numbers_stripped = rem_comm_spaces(numbers)
    num_only = only_num(numbers_stripped)
    while num_only == False:
        numbers = format_input(numbers)
        if numbers == 'quit':
            sys.exit()
        else:
            print("I'm sorry, but you seem to have entered \
a letter, an invalid punctuation mark, or the empty string. \
Please try again." + '\n')
            numbers = get_numbers()
            numbers_stripped = rem_comm_spaces(numbers)
            num_only = only_num(numbers_stripped)
            continue
    return numbers
コード例 #7
0
 def test_three(self):
     self.assertEqual(rem_comm_spaces(' T! u,/  L'), 'T!u/L')
コード例 #8
0
 def test_two(self):
     self.assertEqual(rem_comm_spaces(' , , , , '), '')
コード例 #9
0
 def test_one(self):
     self.assertEqual(rem_comm_spaces(''), '')
コード例 #10
0
 def test_three(self):
     self.assertEqual(rem_comm_spaces(' T! u,/  L'),'T!u/L')
コード例 #11
0
 def test_two(self):
     self.assertEqual(rem_comm_spaces(' , , , , '),'')
コード例 #12
0
 def test_one(self):
     self.assertEqual(rem_comm_spaces(''),'')