コード例 #1
0
ファイル: main.py プロジェクト: DianaPurice/COM411
def run_block_d():
  is_running = True
  while is_running:
    print("Which program in 'Block D: Basics (Funcions and Modules)' do you wish to run?'")
    print("[1] ascii_code\n[2] ascii_character\n[3] simple_function\n[4] function_with_nesting\n[5] function_with_parameter\n[6] function_with_loop\n[7] function_with_parameters\n[8] multiple_functions\n[9] return_values\n[10] function_calls\n[11] guess_the_number\n[12] quit")
    response = input()
    if (response == "1"):
      ascii_code.run()
    elif (response == "2"):
        ascii_character.run()
    elif (response == "3"):
        simple_function.run()
    elif (response == "4"):
        function_with_nesting.run()
    elif (response == "5"):
        function_with_parameter.run()
    elif (response == "6"):
        function_with_loop.run()
    elif (response == "7"):
        function_with_parameters.run()
    elif (response == "8"):
        multiple_functions.run()
    elif (response == "9"):
        return_values.run()
    elif (response == "10"):
        function_calls.run()
    elif (response == "11"):
        guess_the_number.run
    elif (response == "12"):
      break
    else:
      print("Invalid option! Please try again.")
コード例 #2
0
ファイル: main.py プロジェクト: danbird2021/com728
def run_functions():
    while (True):
        print("""Run any of the following from Block A: Functions:
                 [a] : ascii_character.py
                 [b] : ascii_code.py
                 [c] : function_calls.py
                 [d] : function_with_loop.py
                 [e] : function_with_nesting.py
                 [f] : function_with_parameter.py
                 [g] : function_with_parameters.py
                 [h] : multiple_functions.py
                 [i] : return_values.py
                 [j] : simple_function.py
                 [m] : Block A Menu """)
        response = input()

        if response == "a":
            ascii_character.run()
        elif response == "b":
            ascii_code.run()
        elif response == "c":
            function_calls.run()
        elif response == "d":
            f_with_loop.run()
        elif response == "e":
            f_with_nesting.run()
        elif response == "f":
            f_with_parameter.run()
        elif response == "g":
            f_with_parameters.run()
        elif response == "h":
            multiple_functions.run()
        elif response == "i":
            return_values.run()
        elif response == "j":
            simple_function.run()
        elif response == "m":
            break
        else:
            print("Invalid option! Please try again.")
コード例 #3
0
def run_functions():
    while (True):
        print("[a] use of abs, chr function program")
        print("[b] use of len, ord function program")
        print("[c] function calls program")
        print("[d] function with loop program")
        print("[e] function with nesting decision program")
        print("[f] function with parameter program")
        print("[g] function with parameters program")
        print("[h] return values program")
        print("[i] simple function program")
        print("[q] to quit")
        print(" please Enter which program you want to Execute")
        print(" press a/b/c/d/e/f/g/h/q")
        choice = input().lower().strip()
        if choice == "a":
            ascii_character.run()
        elif choice == "b":
            ascii_code.run()
        elif choice == "c":
            function_calls.run()
        elif choice == "d":
            function_with_loop.run()
        elif choice == "e":
            function_with_nesting.run()
        elif choice == "f":
            function_with_parameter.run()
        elif choice == "g":
            function_with_parameters.run()
        elif choice == "h":
            return_values.run()
        elif choice == "i":
            simple_function.run()
        elif choice == "q":
            break
        else:
            print("Invalid option! Please try again.")
コード例 #4
0
def run_block_a():
    print("Which program in 'Block A: Basics' do you wish to run?")
    response = input()
    if (response == "simple_message"):
        print("")
        simple_message.run()
    elif (response == "multiline_message"):
        print("")
        multiline_message.run()
    elif (response == "ascii_art"):
        print("")
        ascii_art.run()
    elif (response == "escape_characters"):
        print("")
        escape_characters.run()
    elif (response == "data_types"):
        print("")
        data_types.run()
    elif (response == "input_review"):
        print("")
        input_review.run()
    elif (response == "string_operators"):
        print("")
        string_operators.run()
    elif (response == "user_input"):
        print("")
        user_input.run()
    elif (response == "comparison_operator"):
        print("")
        comparison_operator.run()
    elif (response == "counter"):
        print("")
        counter.run()
    elif (response == "if_elif_else"):
        print("")
        if_elif_else.run()
    elif (response == "if_else"):
        print("")
        if_else.run()
    elif (response == "if_"):
        print("")
        if_.run()
    elif (response == "modulo_operator"):
        print("")
        modulo_operator.run()
    elif (response == "and_operator"):
        print("")
        and_operator.run()
    elif (response == "or_operator"):
        print("")
        or_operator.run()
    elif (response == "nestception"):
        print("")
        nestception.run()
    elif (response == "nested"):
        print("")
        nested.run()
    elif (response == "decisions_review"):
        print("")
        decisions_review.run()
    elif (response == "characters"):
        print("")
        characters.run()
    elif (response == "count_down"):
        print("")
        count_down.run()
    elif (response == "membership_operators"):
        print("")
        membership_operators.run()
    elif (response == "range_"):
        print("")
        range_.run()
    elif (response == "for_loop_reverse"):
        print("")
        for_loop_reverse.run()
    elif (response == "for_loop_simple"):
        print("")
        for_loop_simple.run()
    elif (response == "nested_loop_nested"):
        print("")
        nested_loop_nested.run()
    elif (response == "nesting"):
        print("")
        nesting.run()
    elif (response == "count"):
        print("")
        count.run()
    elif (response == "factorial"):
        print("")
        factorial.run()
    elif (response == "sum_user_numbers"):
        print("")
        sum_user_numbers.run()
    elif (response == "sum100"):
        print("")
        sum100.run()
    elif (response == "while_loop_simple"):
        print("")
        while_loop_simple.run()
    elif (response == "while_loop_ascii"):
        print("")
        while_loop_ascii.run()
    elif (response == "while_loop_len"):
        print("")
        while_loop_len.run()
    elif (response == "ascii_character"):
        print("")
        ascii_character.run()
    elif (response == "ascii_code"):
        print("")
        ascii_code.run()
    elif (response == "function_calls"):
        print("")
        function_calls.run()
    elif (response == "function_with_loop"):
        print("")
        function_with_loop.run()
    elif (response == "function_with_nesting"):
        print("")
        function_with_nesting.run()
    elif (response == "function_with_parameter"):
        print("")
        function_with_parameter.run()
    elif (response == "function_with_parameters"):
        print("")
        function_with_parameters.run()
    elif (response == "multiple_functions"):
        print("")
        multiple_functions.run()
    elif (response == "return_values"):
        print("")
        return_values.run()
    elif (response == "simple_function"):
        print("")
        simple_function.run()
    elif (response == "guess_the_number"):
        print("")
        guess_the_number.run()
コード例 #5
0
def run_block_a():
    print("Which program in 'Block A: Basics' do you wish to run?")
    response = input()

    #Output
    if (response == "simple_message"):
        simple_message.run()
    elif (response == "multiline_message"):
        multiline_message.run()
    elif (response == "escape_characters"):
        escape_characters.run()
    elif (response == "ascii_art"):
        ascii_art.run()

    #Input
    elif (response == "user_input"):
        user_input.run()
    elif (response == "ascii_robot"):
        ascii_robot.run()
    elif (response == "data_types"):
        data_types.run()
    elif (response == "string_operators"):
        string_operators.run()

    #Decisions> Simple Decisions
    elif (response == "if_"):
        if_.run()
    elif (response == "if_else"):
        if_else.run()
    elif (response == "if_elif_else"):
        if_elif_else.run()
    elif (response == "modulo_operator"):
        modulo_operator.run()
    elif (response == "comparison_operators"):
        comparison_operators.run()
    elif (response == "counter"):
        counter.run()
    elif (response == "nested"):
        nested.run()
    elif (response == "nestception"):
        nestception.run()
    elif (response == "or_operator"):
        or_operator.run()
    elif (response == "and_operator"):
        and_operator.run()

    #Repetitions
    #Repetitions> while_loop
    elif (response == "simple_while_loop"):
        simple_while_loop.run()
    elif (response == "count"):
        count.run()
    elif (response == "ascii_"):
        ascii_.run()
    elif (response == "sum_100"):
        sum_100.run()
    elif (response == "sum_user_numbers"):
        sum_user_numbers.run()
    elif (response == "factorial"):
        factorial.run()
    elif (response == "len_"):
        len_.run()

    #Repetitions> for_loop
    elif (response == "simple_for_loop"):
        simple_for_loop.run()
    elif (response == "count_down"):
        count_down.run()
    elif (response == "range_"):
        range_.run()
    elif (response == "characters"):
        characters.run()
    elif (response == "reverse"):
        reverse.run()
    elif (response == "membership_operators"):
        membership_operators.run()

    #Repetitions> nested_loop
    elif (response == "nested_"):
        nested_.run()
    elif (response == "nesting"):
        nesting.run()

    #Functions
    elif (response == "ascii_code"):
        ascii_code.run()
    elif (response == "ascii_character"):
        ascii_character.run()
    elif (response == "simple_function"):
        simple_function.run()
    elif (response == "function_with_nesting"):
        function_with_nesting.run()
    elif (response == "function_with_parameter"):
        function_with_parameter.run()
    elif (response == "function_with_loop"):
        function_with_loop.run()
    elif (response == "function_with_parameters"):
        function_with_parameters.run()
    elif (response == "multiple_functions"):
        multiple_functions.run()
    elif (response == "return_values"):
        return_values.run()
    elif (response == "function_calls"):
        function_calls.run()

    #Modules
    elif (response == "guess_the_number"):
        guess_the_number.run()
コード例 #6
0
def run_block_a():
    print("Which program in 'Block A: Basics' do you wish to run?")
    response = input()

    # function calls for basics --> output
    if response == "simple_message":
        simple_message.run()
    elif response == "multiline_message":
        multiline_message.run()
    elif response == "ascii_art":
        ascii_art.run()
    elif response == "escape_characters":
        escape_characters.run()

    # function calls for basics --> repetitions --> while loops
    elif response == "sum_user_numbers":
        sum_user_numbers.run()
    elif response == "sum_100":
        sum_100.run()
    elif response == "while_simple":
        while_simple.run()
    elif response == "len":
        len.run()
    elif response == "factorial":
        factorial.run()
    elif response == "count":
        count.run()
    elif response == "ascii":
        ascii.run()

    # function calls for basics --> repetitions --> nested loops
    elif response == "nested":
        nested.run()
    elif response == "nesting":
        nesting.run()

    # function calls for basics --> repetitions --> for loops
    elif response == "characters":
        characters.run()
    elif response == "count_down":
        count_down.run()
    elif response == "membership_operators":
        membership_operators.run()
    elif response == "range":
        range.run()
    elif response == "reverse":
        reverse.run()
    elif response == "simple":
        simple.run()

    # function calls for basics --> modules
    elif response == "guess_the_number":
        guess_the_number.run()

    # function calls for basics --> input
    elif response == "ascii_robot":
        ascii_robot.run()
    elif response == "data_types":
        data_types.run()
    elif response == "review_beeps_garden":
        review_beeps_garden.run()
    elif response == "string_operators":
        string_operators.run()
    elif response == "user_input":
        user_input.run()

    # function calls for basics --> functions
    elif response == "ascii_character":
        ascii_character.run()
    elif response == "ascii_code":
        ascii_code.run()
    elif response == "function_calls":
        function_calls.run()
    elif response == "function_with_loop":
        function_with_loop.run()
    elif response == "function_with_nesting":
        function_with_nesting.run()
    elif response == "function_with_parameter":
        function_with_parameter.run()
    elif response == "function_with_parameters":
        function_with_parameters.run()
    elif response == "multiple_functions":
        multiple_functions.run()
    elif response == "return_values":
        return_values.run()
    elif response == "simple_function":
        simple_function.run()

    # function calls for basics --> decisions
    elif response == "and_operator":
        and_operator.run()
    elif response == "or_operator":
        or_operator.run()
    elif response == "decision_review":
        decision_review.run()

    # function calls for basics --> decisions --> simple decision
    elif response == "comparison_operators":
        comparison_operators.run()
    elif response == "counter":
        counter.run()
    elif response == "decision_if":
        decision_if.run()
    elif response == "if_elif_else":
        if_elif_else.run()
    elif response == "if_else":
        if_else.run()
    elif response == "modulo_operator":
        modulo_operator.run()

    # function calls for basics --> decisions --> nested decision
    elif response == "nestception":
        nestception.run()
    elif response == "nested_decision":
        nested_decision.run()

    else:
        print("please enter a valid response")
コード例 #7
0
def run_block_a():
    print("Which program in 'Block A: Basics' do you wish to run?")
    response = input()
    if response == "simple_message":
        simple_message.run()
    elif response == "multiline_message":
        multiline_message.run()
    elif response == "escape_characters":
        escape_characters.run()
    elif response == "ascii_art":
        ascii_art.run()
    elif response == "ascii_robot":
        ascii_robot.run()
    elif response == "data_types":
        data_types.run()
    elif response == "review_input":
        review_input.run()
    elif response == "string_operators":
        string_operators.run()
    elif response == "user_input":
        user_input.run()
    elif response == "review_decisions":
        review_decisions.run()
    elif response == "or_operator":
        or_operator.run()
    elif response == "and_operator":
        and_operator.run()
    elif response == "comparison_operators":
        comparison_operators.run()
    elif response == "counter":
        counter.run()
    elif response == "if_elif":
        if_elif.run()
    elif response == "if_else":
        if_else.run()
    elif response == "modulo_operator":
        modulo_operator.run()
    elif response == "nestception":
        nestception.run()
    elif response == "nested":
        nested.run()
    elif response == "count_down":
        count_down.run()
    elif response == "characters":
        characters.run()
    elif response == "membership_operators":
        membership_operators.run()
    elif response == "range":
        range.run()
    elif response == "reverse":
        reverse.run()
    elif response == "simple_for":
        simple_for.run()
    elif response == "nested_loop":
        nested_loop.run()
    elif response == "nesting":
        nesting.run()
    elif response == "ascii_while":
        ascii_while.run()
    elif response == "count":
        count.run()
    elif response == "factorial":
        factorial.run()
    elif response == "len":
        len.run()
    elif response == "simple_while":
        simple_while.run()
    elif response == "sum_100":
        sum_100.run()
    elif response == "sum_user_numbers":
        sum_user_numbers.run()
    elif response == "ascii_character":
        ascii_character.run()
    elif response == "ascii_code":
        ascii_code.run()
    elif response == "function_calls":
        function_calls.run()
    elif response == "function_with_loop":
        function_with_loop.run()
    elif response == "function_with_nesting":
        function_with_nesting.run()
    elif response == "function_with_parameter":
        function_with_parameter.run()
    elif response == "function_with_parameters":
        function_with_parameters.run()
    elif response == "multiple_functions":
        multiple_functions.run()
    elif response == "return_values":
        return_values.run()
    elif response == "simple_function":
        simple_function.run()
    elif response == "guess_the_number":
        guess_the_number.run()
    else:
        print("Invalid response! Please try again.")