Monday, 27 April 2020

Check whether K-th bit is set or not | Python | Castor Classes

Code:


t=int(input());
i=0;
while(i<t):
    a=int(input());
    k=int(input());
    w=bin(a);
    w=w[2:];
    if(w[len(w)-k-1]=='1'):
        print("Yes");
    else:
        print("No");
    i=i+1;
Python for beginners: https://www.youtube.com/watch?v=egq7Z...

0 Comments:

Post a Comment

Codecademy Code Foundations

Popular Posts

Categories

Android (23) AngularJS (1) Assembly Language (2) Books (10) C (75) C# (12) C++ (81) Course (1) Data Strucures (4) Downloads (1) Engineering (13) flutter (1) FPL (17) Hadoop (1) HTML&CSS (38) IS (25) Java (87) Leet Code (4) PHP (20) Projects (10) Python (249) R (69) Selenium Webdriver (2) Software (14) SQL (27)