Beispiel #1
0
def run_while_loops():
    while (True):
        print(
            """Run any of the following from Block A: Repetitions: While loops:
                 [a] : ascii.py
                 [b] : count.py
                 [c] : factorial.py
                 [d] : len.py
                 [e] : simple.py
                 [f] : sum_100.py
                 [g] : sum_user_numbers.py
                 [m] : Block A Menu """)
        response = input()

        if response == "a":
            ascii.run()
        elif response == "b":
            count.run()
        elif response == "c":
            factorial.run()
        elif response == "d":
            len.run()
        elif response == "e":
            simple_while_loop.run()
        elif response == "f":
            sum_100.run()
        elif response == "g":
            sum_user_numbers.run()
        elif response == "m":
            break
        else:
            print("Invalid option! Please try again.")
Beispiel #2
0
def run_block_c1():
  is_running = True
  while is_running:
    print("Which program in 'Block C: Basics (Repetitions: Part 1)' do you wish to run?'")
    print("""[1] simple_while
[2] count_while
[3] ascii_while
[4] len_while
[5] sum_100
[6] sum_user_numbers
[7] factorial
[8] simple_for
[9] count_down
[10] range_for
[11] characters_for
[12] quit """)
    response = input()
    if (response == "1"):
        simple_while.run()
    elif (response == "2"):
        count_while.run()
    elif (response == "3"):
        ascii_while.run()
    elif (response == "4"):
        len_while.run()
    elif (response == "5"):
        sum_100.run()
    elif (response == "6"):
        sum_user_numbers.run()
    elif (response == "7"):
        factorial.run()
    elif (response == "8"):
        simple_for.run()
    elif (response == "9"):
        count_down.run()
    elif (response == "10"):
        range_for.run()
    elif (response == "11"):
        characters_for.run()
    elif (response == "12"):
        break
    else:
      print("Invalid option! Please try again.")
Beispiel #3
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()
Beispiel #4
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")
Beispiel #5
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_type"):
        data_type.run()
    elif (response == "string_operators"):
        string_operators.run()
    elif (response == "user_input"):
        user_input.run()
    elif (response == "and_operator"):
        and_operator.run()
    elif (response == "or_operator"):
        or_operator.run()
    elif (response == "nestception"):
        nestception.run()
    elif (response == "nested_decision"):
        nested_decision.run()
    elif (response == "comparison_operator"):
        comparison_operator.run()
    elif (response == "counter"):
        counter.run()
    elif (response == "if_elif_else"):
        if_elif_else.run()
    elif (response == "if_else"):
        if_else.run()
    elif (response == "if_code"):
        if_code.run()
    elif (response == "modulo_operator"):
        modulo_operator.run()
    elif (response == "ascii_reverse"):
        ascii_reverse.run()
    elif (response == "ascii_function"):
        ascii_function.run()
    elif (response == "function_call"):
        function_call.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 == "characters"):
        characters.run()
    elif (response == "countdown"):
        countdown.run()
    elif (response == "membership_operators"):
        membership_operators.run()
    elif (response == "ranged"):
        ranged.run()
    elif (response == "reverse"):
        reverse.run()
    elif (response == "for_simple"):
        for_simple.run()
    elif (response == "nested"):
        nested.run()
    elif (response == "nesting"):
        nesting.run()
    elif (response == "while_ascii"):
        while_ascii.run()
    elif (response == "count"):
        count.run()
    elif (response == "factorial"):
        factorial.run()
    elif (response == "lenloop"):
        lenloop.run()
    elif (response == "simple"):
        simple.run()
    elif (response == "sum_100"):
        sum_100.run()
    elif (response == "sum_of_user"):
        sum_of_user.run()
    elif (response == "guess_the_numnber"):
        guess_the_numnber.run()
    else:
        print("\nError!!!")
Beispiel #6
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.")