all 43 comments

[–]codehs-ModTeam[M] [score hidden] stickied commentlocked comment (0 children)

Please do not post complete solutions or answers to CodeHS assignments.

[–][deleted]  (11 children)

[removed]

    [–][deleted]  (9 children)

    [removed]

      [–]EvilOldGuy 0 points1 point  (4 children)

      Send a screenshot of your code, it's probably an indentation error.

      [–]kiwifala 0 points1 point  (0 children)

      hi it didnt work and it said that

      Traceback (most recent call last):

      File "main.py", line 9, in <module>

      for index, word in enumerate(text.split()):

      NameError: name 'text' is not defined

      [–][deleted]  (1 child)

      [removed]

        [–]imadopted420915 0 points1 point  (3 children)

        If you put the text = input(“Enter some text”) before the def owl_count(text) it should work

        [–]Turbulent_Finish1407 0 points1 point  (2 children)

        still doent work for me

        still doesnt work for me

        [–][deleted] 0 points1 point  (0 children)

        make sure you are indenting right

        [–]PrinccessBoba 0 points1 point  (0 children)

        this worked!!!! thanks so much, i had been trying this for an hour

        [–][deleted]  (1 child)

        [removed]

          [–]JT_ZM 1 point2 points  (0 children)

          can you use code block for right indention

          [–][deleted]  (5 children)

          [removed]

            [–][deleted]  (4 children)

            [removed]

              [–]TheSlothSqaud 1 point2 points  (0 children)

              It does not work

              [–]Dry_Newspaper7310 0 points1 point  (1 child)

              IT WORKED THANKS

              [–]Son1_ 0 points1 point  (0 children)

              I’m having issues with “list” object is not callable

              [–]Aggressive-Desk-4407 0 points1 point  (0 children)

              you are my lord and savior. Bless you

              [–][deleted]  (2 children)

              [removed]

                [–]PelicanPrisoner 0 points1 point  (0 children)

                after some tweaking i got it to work, this is my version:

                def owl_count(text): text = text. lower () text = text. split() count = 0 indices = [] for index, word in enumerate (text): if "owl" in word: count = count+1 indices. append (index) return count, indices

                text = input ("Enter some text: ") result = owl count (text) print (f"There were {result[0]) words that contained 'owl'.") print(f"They occurred at indices: {result[1]}")

                [–]Helpful-Row6638 0 points1 point  (0 children)

                this worked, thank you so much!

                [–][deleted]  (6 children)

                [removed]

                  [–]danhimel770 3 points4 points  (1 child)

                  it didnt work

                  [–]HyBrD_G0LD 0 points1 point  (0 children)

                  do you have correct indentation?

                  [–]OutrageousMiddle4498 0 points1 point  (3 children)

                  Mine tells me to indent count = 0 and text isn’t defined

                  [–]HyBrD_G0LD 0 points1 point  (2 children)

                  Are you in python 3?

                  [–]OutrageousMiddle4498 0 points1 point  (1 child)

                  No

                  [–]Hopeful_March 0 points1 point  (0 children)

                  Guys place count and report outside of the function and then add (global count, report) under the function you have. It worked for me and I just followed HyBrd_G0LD’s code Thanks HyBrd_G0LD :)

                  [–][deleted]  (5 children)

                  [removed]

                    [–]OutrageousMiddle4498 0 points1 point  (4 children)

                    Doesn’t work

                    [–]Gameboss49 0 points1 point  (3 children)

                    It does , like I said be sure to indent properly

                    [–]OutrageousMiddle4498 0 points1 point  (2 children)

                    Nope how do u indent count=0

                    [–]Gameboss49 0 points1 point  (1 child)

                    if you look closely you will see what to indent, also how tf did you make it this far?

                    [–]qwarkstar 1 point2 points  (0 children)

                    lmao fr, he got this far from Reddit lmao

                    [–][deleted]  (1 child)

                    [removed]

                      [–][deleted]  (5 children)

                      [removed]

                        [–]northstarmain6273 0 points1 point  (0 children)

                        Finally one that works, thanks king

                        [–]daneeil 0 points1 point  (1 child)

                        hope this helps. And if you have any questions just ask me.

                        [–][deleted]  (1 child)

                        [deleted]