reasoning under uncertainty if var in fac variablescontains_var append(facelsenot_contains_var append(facif contains_var =[]return factors elsenewfactor factorsum(var,contains_varself display( ,"multiplying:",[str(ffor in contains_var]self display( ,"creating factor:"newfactorself display( newfactor to_table()factor in detail not_contains_var append(newfactorreturn not_contains_var from probgraphicalmodels import bn_ cha, , , bn_ chv ve(bn_ ch#bn_ chv query( ,{}#bn_ chv query( ,{}#inferencemethod max_display_level show more detail in displaying #inferencemethod max_display_level show less detail in displaying #bn_ chv query( ,{ :true}#bn_ chv query( ,{ :true, :false} from probgraphicalmodels import bn_report,alarm,fire,leaving,report,smoke,tamper bn_reportv ve(bn_reportanswers queries using variable elimination #bn_reportv query(tamper,{}#inferencemethod max_display_level show no detail in displaying #bn_reportv query(leaving,{}#bn_reportv query(tamper,{},elim_order=[smoke,report,leaving,alarm,fire]#bn_reportv query(tamper,{report:true}#bn_reportv query(tamper,{report:true,smoke:false} from probgraphicalmodels import bn_sprinklerseasonsprinklerrainedgrass_wetgrass_shinyshoes_wet bn_sprinklerv ve(bn_sprinkler#bn_sprinklerv query(shoes_wet,{}#bn_sprinklerv query(shoes_wet,{rained:true}#bn_sprinklerv query(shoes_wet,{grass_shiny:true}#bn_sprinklerv query(shoes_wet,{grass_shiny:false,rained:true} from probgraphicalmodels import bn_lr coughfeversneezecoldflucovid vediag ve(bn_lr #vediag query(cough,{}#vediag query(cold,{cough: ,sneeze: ,fever: }#vediag query(flu,{cough: ,sneeze: ,fever: }#vediag query(covid,{cough: ,sneeze: ,fever: }#vediag query(covid,{cough: ,sneeze: ,fever: ,flu: }#vediag query(covid,{cough: ,sneeze: ,fever: ,flu: }version june