0
def romanToInt(self, s: str) -> int

This is function name and this format is used in python. I am confused why we are using this arrow and why we are using int inside paranthesis after s. Can someone explain please?

juanpa.arrivillaga
  • 77,035
  • 9
  • 115
  • 152
user13157507
  • 21
  • 1
  • 1

1 Answers1

0

They are function annotations.

-> marks the return function annotation indicating the function returns an int.

The : str indicates a string argument.

You can read more about them here.

Or, SO: What does -> mean in Python function definitions?

jonrsharpe
  • 107,083
  • 22
  • 201
  • 376
Sanil
  • 349
  • 2
  • 7
  • 4
    Questions that you know to be duplicative should be closed, not answered. See the "Answer Well-Asked Questions" section of [How to Answer](https://stackoverflow.com/help/how-to-answer), including the bullet point regarding questions that "have already been asked and answered many times before". – Charles Duffy Mar 30 '20 at 20:40