Friday, May 29, 2020

Answer for Two sum code

https://365datascience.com/dwqa-answer/answer-for-two-sum-code/ -

Hi Thadathon, 

thanks for reaching out!

An ‘else’ statement is not necessary in the Python. This is a particular feature of the Python programming language. Python strives to have clear syntax and be easy to use by programmers, which includes avoiding what are deemed unnecessary words or lines of code. In other languages, such as Java and C++ you need the ‘else’ statement.

But as there is no ‘else statement’ you need to indent your code precisely, so the compiler knows to which statement the ‘return’ is referring. So, if the ‘return’ is connected to the ‘for‘ statement from above, it needs to be indented with the same amount of white space. 

 

Best, 

Eli 




#365datascience #DataScience #data #science #365datascience #BigData #tutorial #infographic #career #salary #education #howto #scientist #engineer #course #engineer #MachineLearning #machine #learning #certificate #udemy

No comments:

Post a Comment