omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    Help with 2 Python questions

    Pythonista
    5
    10
    5761
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Pythonistapro777
      Pythonistapro777 last edited by Pythonistapro777

      This post is deleted!
      Phuket2 1 Reply Last reply Reply Quote 0
      • Webmaster4o
        Webmaster4o last edited by

        Your answer to question 2 is wrong. This is also not an appropriate question for this forum (in my opinion) as it has nothing to do with pythonista, it's just generally about Python. Please post it on stackoverflow.

        1 Reply Last reply Reply Quote 0
        • Pythonistapro777
          Pythonistapro777 last edited by Pythonistapro777

          This post is deleted!
          1 Reply Last reply Reply Quote 0
          • Webmaster4o
            Webmaster4o last edited by

            I think so.

            1 Reply Last reply Reply Quote 0
            • dgelessus
              dgelessus last edited by

              Not to be rude, but asking us to do the quiz for you doesn't help you in any way. If we tell you the answers, you'll complete the quiz, but you haven't learned anything. The next time you get a similar question in an exam, you won't be able to answer it correctly (especially if your exam is not a multiple-choice test and you have to write a full answer yourself).

              If you're not sure that your answers are correct, look through your school book or worksheets that you were given in class. If you were right, then great! If not, then compare the correct answer with the one you thought was right and see what you understood wrong. The next time you'll know better. If you're still unsure and have more questions, ask your classmates or your teacher. They can answer your questions better than we can, because they know what you've already learned in class. Not to mention that it's a lot quicker to ask someone in real life than to wait hours for random internet people. ;)

              1 Reply Last reply Reply Quote 0
              • Pythonistapro777
                Pythonistapro777 last edited by

                This post is deleted!
                1 Reply Last reply Reply Quote 0
                • ccc
                  ccc last edited by ccc

                  Question 2 is easy to figure out:

                  • Change all occurrences of 'line' to 'print ' (with a trailing space before the number).
                  • Add ' ; throw(Error)' to the end of line 3.
                  • Make sure your indentation exactly matches the quiz question.
                  • Run the program for you answer.
                  1 Reply Last reply Reply Quote 0
                  • dgelessus
                    dgelessus last edited by

                    @ccc said:

                    • Add ' ; throw(Error)' to the end of line 3.

                    Normally you'd write raise Exception(). Of course throw(Error) works as well - it'll give you a NameError, because the name throw is not defined. ;)

                    1 Reply Last reply Reply Quote 2
                    • ccc
                      ccc last edited by

                      LOL... Good catch. You are correct.

                      1 Reply Last reply Reply Quote 0
                      • Phuket2
                        Phuket2 @Pythonistapro777 last edited by

                        @Pythonistapro777 , are you on stackflow? It's a great site. Covers a lot of languages, I guess probably all. Absolute massive database of answers to all sorts of questions. I ask some Python oriented questions here sometimes because I am not exactly sure if there are some limitations or differences about running in Pythonista.
                        But look if you are not on stackflow, get on there ASAP. You will love it. So many things have already been answered. I use use it all the time. As far as I know, it's the by far the biggest programming resouce on the web. No sign up fees, you can sign in with your Facebook account if you wish.
                        Again, don't sweat it too much. It's just using the right resources for the right answers. You also have to be disciplined on stackflow. They want you to search for your answer first, rather than just post a question. Its understandable, otherwise you end up with literally thousands of duplicated questions.
                        Btw, I would have got question 2 wrong also :) but I would have done what was suggested by putting in the print statements.
                        Happy coding!

                        1 Reply Last reply Reply Quote 1
                        • First post
                          Last post
                        Powered by NodeBB Forums | Contributors