Skip to content
I have codes in JavaScript. How can i convert it into Python
Profile icon

//#1 -- For loop in Javascript.
const fish = ['dory', 'bruce', 'marlin', 'nemo'];
const nemo = ['nemo'];
const everyone = ['dory', 'bruce', 'marlin', 'nemo', 'gill', 'bloat', 'nigel', 'squirt', 'darla', 'hank'];
const large = new Array(10).fill('nemo');

function findNemo2(fish) {
let t0 =;
for (let i = 0; i < fish.length; i++) {
if (fish[i] === 'nemo') {
console.log('Found NEMO!');
let t1 =;
console.log("Call to find Nemo took " + (t1 - t0) + " milliseconds.");


You are viewing a single comment. View All
Profile icon

If for some reason you need this converted from JS to Python, I can do that for you

Converted Repl
Let me know if it doesn't work as intended