{"id":885,"date":"2021-06-14T13:35:55","date_gmt":"2021-06-14T08:05:55","guid":{"rendered":"https:\/\/techieshouts.com\/?p=885"},"modified":"2022-08-09T19:04:28","modified_gmt":"2022-08-09T13:34:28","slug":"checking-multiple-boolean-at-a-time","status":"publish","type":"post","link":"https:\/\/techieshouts.com\/home\/checking-multiple-boolean-at-a-time\/","title":{"rendered":"Checking Multiple Boolean at a time"},"content":{"rendered":"\n<p>Let us take a  real-time example of the banking system. The bank wants to offer a loan only to the active premium customers who are not on the defaulter&#8217;s list. For this, we are using the following code in python.<\/p>\n\n\n\n<h4>Method: 1<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"godzilla\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">isActive,isPremium,isDefaulter=1,1,0\nif isActive==1 and isPremium==1 and isDefaulter==1:\n    print('Eligible for Loan')\nelse:\n    print('Not Eligible')<\/pre>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"raw\" data-enlighter-theme=\"dracula\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">Output:\nNot Eligible<\/pre>\n\n\n\n<h4>Method: 2<\/h4>\n\n\n\n<p>In this example, if the bank gives a loan to the customer which are all is an active premium and also the defaulter, the code we write as, <\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"classic\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">isActive,isPremium,isDefaulter=1,1,0\nif isActive==1 or isPremium==1 or isDefaulter==1:\n    print('Eligible for Loan')\nelse:\n    print('Not Eligible')<\/pre>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"raw\" data-enlighter-theme=\"dracula\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">Output:\nEligible for Loan<\/pre>\n\n\n\n<h4>Method: 3<\/h4>\n\n\n\n<p>In the below methods, if any one of the options is true, we use the following codes.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"classic\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">isActive,isPremium,isDefaulter=1,1,0\nif 1 in (isActive,isPremium,isDefaulter):\n    print('Eligible for Loan')\nelse:\n    print('Not Eligible')<\/pre>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"raw\" data-enlighter-theme=\"dracula\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">Output:\nEligible for Loan<\/pre>\n\n\n\n<h4>Method: 4<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"godzilla\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">isActive,isPremium,isDefaulter=1,1,0\nif any ((isActive,isPremium,isDefaulter)):\n    print('Eligible for Loan')\nelse:\n    print('Not Eligible')<\/pre>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"raw\" data-enlighter-theme=\"dracula\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">Output:\nEligible for Loan<\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p>  <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Let us take a real-time example of the banking system. The bank wants to offer a loan only to the active premium customers who are not on the defaulter&#8217;s list. For this, we are using the following code in python. Method: 1 Method: 2 In this example, if the bank gives a loan to the\u2026 <span class=\"read-more\"><a href=\"https:\/\/techieshouts.com\/home\/checking-multiple-boolean-at-a-time\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[7,14],"tags":[118,117,119,120],"_links":{"self":[{"href":"https:\/\/techieshouts.com\/home\/wp-json\/wp\/v2\/posts\/885"}],"collection":[{"href":"https:\/\/techieshouts.com\/home\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/techieshouts.com\/home\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/techieshouts.com\/home\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/techieshouts.com\/home\/wp-json\/wp\/v2\/comments?post=885"}],"version-history":[{"count":6,"href":"https:\/\/techieshouts.com\/home\/wp-json\/wp\/v2\/posts\/885\/revisions"}],"predecessor-version":[{"id":919,"href":"https:\/\/techieshouts.com\/home\/wp-json\/wp\/v2\/posts\/885\/revisions\/919"}],"wp:attachment":[{"href":"https:\/\/techieshouts.com\/home\/wp-json\/wp\/v2\/media?parent=885"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/techieshouts.com\/home\/wp-json\/wp\/v2\/categories?post=885"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/techieshouts.com\/home\/wp-json\/wp\/v2\/tags?post=885"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}