From 63645fe4f50d1b613ed6a1c3399d500e5f2bec69 Mon Sep 17 00:00:00 2001 From: Arian <63389738+ArianKhadem@users.noreply.github.com> Date: Sun, 26 Apr 2020 19:03:34 +0430 Subject: [PATCH] Create Laptop_cheker --- Laptop_cheker | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 Laptop_cheker diff --git a/Laptop_cheker b/Laptop_cheker new file mode 100644 index 0000000..00e4557 --- /dev/null +++ b/Laptop_cheker @@ -0,0 +1,34 @@ + +def get_data(): + input_number_of_laptops = int(input('Please enter the number of laptops: ')) + input_price_quality = [] + for counter in range(input_number_of_laptops): + input_price_quality.append(input('Please enter the price and quality(put space between them): ')) + return input_number_of_laptops, input_price_quality + + +def input_condition_checker(string): + result, counter = input_checker_AB_or_BA(string, 'a', 'b', 0) + if (result == 'Yes'): + if (input_checker_AB_or_BA(string, 'b', 'a', counter) == 'Yes', counter): + return 'Yes' + elif (input_checker_AB_or_BA(string, 'b', 'a',counter) == 'Yes', counter): + if (input_checker_AB_or_BA(string, 'a', 'b',counter) == 'Yes', counter): + return 'Yes' + return 'No' + + +def input_checker_AB_or_BA(string, check_AorB, check_BorA, counter): + if len(string) >= 4: + for counter in range(counter, len(string)): + if (string[counter] == check_AorB) and (string[counter + 1] == check_BorA): + return 'Yes', counter + return 'No', counter + + +def main_program(): + string = get_data() + # print(input_condition_checker(string)) + + +main_program()