9
ajay06
5y

While I'm doing my hacker rank problem I have seen new word instead of using letter like I,j,k .but it is weired .Can I just know what is t_itr is that has any operation? In for loop "for "t_itr" in range t"

Comments
  • 1
    t for type and itr for iterator?

    By the way, what does angryProfessor do?
  • 3
    Iterator is quite common programming concept so some may take it as common knowledge.
  • 2
    I hate code that's not verbose. I understand it if it's implementing a mathematical algorythm, but commonly it's just better read if it's written without abbreviation and shorted words.
  • 2
    What's up with these watermarks in photos?
  • 0
    @joas what is operation of the for loop and the code that is under for loop.can you explain that?
  • 2
    It looks like a stupid way to handle command line arguments.

    I would use the built in libraries for command line args: https://docs.python.org/3.7/...

    It will produce much cleaner code.
  • 0
    @Demolishun can you explain the above code?
  • 1
    result = 🤦‍♂️
  • 1
    t_itr is just a name like I j or k. You can put anything you want there as long as it's a valid name and it wont change anything
  • 1
    It looks like a form of Hungarian Notation. It's fallen out of favor, but I agree with Joel Spolsky that that's because most people did it wrong.

    Here's his article on doing it right: https://joelonsoftware.com/2005/05/...
  • 0
    It's HackerRank. Solutions are usually set up by default with I/O and some variables that get fed into a solution function.

    Up to Python 2, range creates a list. In Python 3, it creates an iterator. The for syntax here simply iterates through an iterable's iterator. So the variable there just holds the value returned from the iterator per iteration.
  • 1
    Single letter variables?
    Needlessly shortened variables?

    Can you not?
  • 0
    @Root no comment on using user input like this? That's worse imo.
  • 0
    @asgs iter is iterator brother not itr.yeah I solved it's just a variable .
  • 0
    @electrineer Absolutely. I didn't even bother to read it.
  • 0
    @ajay06 no, itr is a very common short form of iterator

    But it doesn't matter what it means when the author couldn't be bothered
Add Comment