This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def print_tables(): | |
for x in range(1, 13): | |
for y in range(1, 13): | |
z = x * y | |
print(z, end="\t") | |
print() #creates the space after the loop | |
def main(): | |
print_tables() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Suspense, useState, useEffect } from 'react'; // React should also be imported | |
const SuspensefulUserProfile = ({ userId } :{ userId: number }) => { //since this file extension is .tsx then type should assign else this will throw error | |
const [data, setData] = useState({}); | |
useEffect(() => { | |
fetchUserProfile(userId).then((profile) => setData(profile)); | |
}, [userId]) // we should not add setData as a dependency here, userId is enough | |
return ( | |
<Suspense fallback={<Loading /> || null}> //fallback should always be here | |
<UserProfile data={data} /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function peopleArray(listOfPeople){ | |
let filteredArray = [] | |
for ( var i = 0; i < listOfPeople.length; i++){ | |
if(listOfPeople[i].age > 30 && listOfPeople[i].age < 40){ | |
filteredArray.push(listOfPeople[i]) | |
} | |
} | |
return filteredArray | |
} |