コード例 #1
0
ファイル: molecular_form_3.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('\n')
            print("I'm sorry, but you seem to have entered \
a letter, an invalid punctuation mark, or the empty string. \
Please try again.")
            print('\n')
            numbers = get_numbers()
            numbers_stripped = rem_comm_spaces(numbers)
            num_only = only_num(numbers_stripped)
            continue
    return numbers
コード例 #2
0
ファイル: molecular_form_3.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('\n')
            print("I'm sorry, but you seem to have entered \
a letter, an invalid punctuation mark, or the empty string. \
Please try again.")
            print('\n')
            numbers = get_numbers()
            numbers_stripped = rem_comm_spaces(numbers)
            num_only = only_num(numbers_stripped)
            continue
    return numbers
コード例 #3
0
 def test_two(self):
     self.assertFalse(only_num('3.455'))
コード例 #4
0
 def test_one(self):
     self.assertTrue(only_num('34205'))
コード例 #5
0
 def test_three(self):
     self.assertFalse(only_num('23434f234324'))