Skip to content

Instantly share code, notes, and snippets.

View gsampath127's full-sized avatar

Sampath Kumar Gajawada gsampath127

View GitHub Profile
async function do() {
await Promise.all([saladPromise, sEggPromise, burgerPromise]);
return "done!";
}
async function PrepareLunch(){
let soup = PourSoup();
console.log("soup is ready");
let saladPromise = new Promise(function(resolve,reject){
resolve(PrepareSalad());
});
let sEggPromise = new Promise(function(resolve,reject){
resolve(PrepareScrambledEgg());
});
let burgerPromise = new Promise(function(resolve,reject){
async function PrepareLunch(){
let soup = PourSoup();
console.log("soup is ready");
let salad = await PrepareSalad();
console.log("salad is ready");
let sEgg = await PrepareScrambledEgg();
console.log("scrambled egg is ready");
let burger = await FryBuns(2);
AddVeggies(burger);
DressBurger(burger);
async function PrepareLunch(){
let soup = PourSoup();
console.log("soup is ready");
let salad = PrepareSalad();
console.log("salad is ready");
let sEgg = PrepareScrambledEgg();
console.log("scrambled egg is ready");
let burger = FryBuns(2);
AddVeggies(burger);
DressBurger(burger);
newMobile.then((message)=>{
console.log(message);
return newBike;
}).then((message)=>{
console.log(message);
return newCar;
}).then((message)=>{
console.log(message);
}).catch((message)=>{
Promise.all([newMobile,newBike,newCar]).then((messages)=>{
console.log(messages);
}).catch((messages)=>{
console.log(messages);
});
let newBike = new Promise((resolve,reject)=>{
let wishToBuy = false;
if(wishToBuy){
resolve({"Product":"Harley-Davidson Fat Boy","Price":"15L"});
}
else{
reject({"reason":"Bike is not up to expectations"});
}
});
newMobile.then((message)=>
{
console.log("Ready to buy a "+message.Product+" having price "+message.Price);
}).catch((message)=>
{
console.log(message.reason);
});
let newMobile = new Promise((resolve,reject)=>{
// searching for a new mobile (asynchronous operation)
let wishToBuy = true;
if(wishToBuy){
resolve({"Product":"iPhone 11","Price":"1L"});
}
else{
reject({"reason":"Mobile is not up to expectations"});
#!/usr/bin/env python
# coding: utf-8
# ## Perform Chi-Square test for Bank Churn prediction (find out different patterns on customer leaves the bank) . Here I am considering only few columns to make things clear
# ### Import libraries
# In[2]: