Exemplo n.º 1
0
def run_for_loops():
    while (True):
        print("""Run any of the following from Block A: Repetitions: For loops:
                 [a] : characters.py.py
                 [b] : count_down.py
                 [c] : membership_operators.py
                 [d] : range.py
                 [e] : reverse.py
                 [f] : simple.py
                 [m] : Block A Menu """)
        response = input()

        if response == "a":
            characters.run()
        elif response == "b":
            count_down.run()
        elif response == "c":
            membership_operators.run()
        elif response == "d":
            range.run()
        elif response == "e":
            reverse.run()
        elif response == "f":
            simple_for_loop.run()
        elif response == "m":
            break
        else:
            print("Invalid option! Please try again.")
Exemplo n.º 2
0
def run_block_c2():
  is_running = True
  while is_running:
    print("Which program in 'Block C: Basics (Repetitions: Part 2)' do you wish to run?'")
    print("[1] reverse\n[2] membership_operators\n[3] nested_for\n[4] nesting\n[5] quit")
    response = input()
    if (response == "1"):
        reverse.run()
    elif (response == "2"):
        membership_operators.run()
    elif (response == "3"):
        nested_for.run()
    elif (response == "4"):
        nesting.run()
    elif (response == "5"):
      break
    else:
      print("Invalid option! Please try again.")
Exemplo n.º 3
0
def run_block_a():
    print("""Which program in 'Block A: Basics' do you wish to run?
    \t 1. Output
    \t 2. input
    \t 3. If statements
    \t 4. Nested Ifs,and AND/ORs
    \t 5. Loops
    \t 6. Functions
    """)
    choice = input()

    if choice == "1":
      print("""Which program in 'Output' do you wish to run?
      \t 1. Simple message
      \t 2. Multiline message
      \t 3. Escape characters
      \t 4. Beep art
      \t 5. Ascii robot
      \t 6. Return to previous menu
      """)
      response = int(input())

      if (response == 1):
        simple_message.run()
      elif (response == 2):
        multiline_message.run()
      elif (response == 3):
        escape_char.run()
      elif (response == 4):
        beep_art.run()
      elif (response == 5):
        ascii_art.run()
      elif (response==6):
        run()
      else:
        print("Please choose a number between 1 and 6")

    if choice == "2":
      print("""Which program in 'Input' do you wish to run?
      \t 1. User input
      \t 2. AScii robot
      \t 3. Data types 
      \t 4. Data types 2 
      \t 5. String operators 
      \t 6. Return to previous menu
      """)
      response = int(input())

      if (response == 1):
        user_input.run()
      elif (response == 2):
        ascii_robot.run()
      elif (response == 3):
        data_types.run()
      elif (response == 4):
        data_types2.run()
      elif (response == 5):
        string_operators.run()
      elif (response==6):
        run()
      else:
        print("Please choose a number between 1 and 6")    

    if choice == "3":
      print("""Which program in 'If statements' do you wish to run?
      \t 1. Simple if
      \t 2. If else
      \t 3. If elif else
      \t 4. modulo
      \t 5. comparison
      \t 6. counter
      \t 7. Return to previous menu
      """)
      response = int(input())

      if (response == 1):
        simple_if.run()
      elif (response == 2):
        if_else.run()
      elif (response == 3):
        if_elif_else.run()
      elif (response == 4):
        modulo.run()
      elif (response == 5):
        comparison.run()
      elif (response==6):
        counter.run()
        or_operator.run()
      elif (response == 7):
        run()
      else:
        print("Please choose a number between 1 and 7")

    if choice == "4":
      print("""Which program in 'Nested Ifs,and AND/ORs' do you wish to run?
      \t 1. Nested
      \t 2. Nestception
      \t 3. AND
      \t 4. OR
      \t 5. Return to previous menu
      """)
      response = int(input())

      if (response == 3):
        and_operator.run()
      elif (response==4):
        or_operator.run()
      elif (response == 1):
        nested.run()
      elif (response == 2):
        nestception.run()
      elif (response == 5):
        run()
      else:
        print("Please choose a number between 1 and 5")

    if choice == "5":
      print("""Which program in 'Loops' do you wish to run?
      \t 1. While loops
      \t 2. For loops
      \t 3. Nested loops
      \t 5. Return to previous menu
      """)
      response = int(input())

      if (response == 1):
        print("""Which program in 'While Loops' do you wish to run?
        \t 1. Simple While loop
        \t 2. Counting while loop
        \t 3. ASCII loop
        \t 4. Repeated word (length of word)
        \t 5. Sum of first 100 numbers
        \t 6. Sum of user numbers
        \t 7. Factorial
        \t 8. Return to main menu
        """)
        reply = int(input())

        if (reply == 1):
          simple_while.run()
        elif (reply==2):
          while_count.run()
        elif (reply == 3):
          while_ascii.run()
        elif (reply == 4):
          while_len.run() 
        elif (reply == 5):
          sum100.run()
        elif (reply == 6):
          sum_user.run()
        elif (reply == 7):
          factorial.run()
        elif (reply == 8):
          run()
        else:
          print("Please choose a number between 1 and 8")

      if (response == 2):
        print("""Which program in 'For Loops' do you wish to run?
        \t 1. Simple For loop
        \t 2. Counting down for loop
        \t 3. Range
        \t 4. Characters
        \t 5. Reverse
        \t 6. Membership
        \t 7. Return to main menu
        """)
        response = int(input())

        if (response == 1):
          simple_for.run()
        elif (response==2):
          count_down.run()
        elif (response == 3):
          for_range.run()
        elif (response == 4):
          for_char.run()
        elif (response == 5):
          for_reverse.run()
        elif (response == 6):
          membership.run()
        elif (response == 8):
          run()
        else:
          print("Please choose a number between 1 and 7")
  
      if (response == 3):
        print("""Which program in 'Nested Loops' do you wish to run?
        \t 1. Nested loop
        \t 2. Nesting loop
        \t 3. Nesting loop 2
        \t 4. Return to main menu
        """)
        reply = int(input())

        if (reply == 1):
          nested_loop.run()
        elif (reply==2):
          nesting_loop.run()
        elif (reply == 3):
          nesting2_loop.run()
        elif (reply == 4):
          run()
        else:
          print("Please choose a number between 1 and 4")

    if choice == "6":
      print("""Which program in 'Functions' do you wish to run?
      \t 1. ASCII function
      \t 2. ASCII Character
      \t 3. Simple function
      \t 4. Nesting function
      \t 5. Function with 1 parameter_function
      \t 6. Function with loop
      \t 7. Function with 2 parameters
      \t 8. Multiple functions
      \t 9. Return function
      \t 10. Function calls
      \t 11. Return to previous menu
      """)
      response = int(input())

      if (response == 1):
        ascii_function.run()
      elif (response == 2):
        asc_char.run()
      elif (response == 3):
        simple_function.run()
      elif (response == 4):
        nesting_function.run()
      elif (response == 5):
        parameter_function.run()
      elif (response == 6):
        loop_function.run()
      elif (response == 7):
        parameters_function.run()
      elif (response == 8):
        multiple_functions.run()
      elif (response == 9):
       return_function.run()
      elif (response == 10):
        function_calls.run()

      elif (response==11):
        run()
      else:
        print("Please choose a number between 1 and 11")
Exemplo n.º 4
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()
Exemplo n.º 5
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")
Exemplo n.º 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_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!!!")
Exemplo n.º 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.")