1
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
  • 88,713
  • 10
  • 131
  • 172
user13157507
  • 31
  • 1
  • 2

1 Answers1

2

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
  • 115,751
  • 26
  • 228
  • 437
Sanil
  • 369
  • 2
  • 7
  • 5
    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