I’m translating a chunk of code I have to use, from C# to Python. I’m not fluent in C#. How would you translate the code?:
JavaScript
x
8
1
Line foundLine = null;
2
for (int j = 0; null == foundLine && j < 2; j++)
3
{
4
do some stuff;
5
}
6
7
8
Advertisement
Answer
This would be the python
translation for the above C#
code:
JavaScript
1
6
1
foundLine = None;
2
j = 0
3
while j < 2 and foundLine is None:
4
#do some stuff;
5
j += 1
6