Monday, 4 May 2020

Find first set bit | Python

Python for beginners:
https://www.youtube.com/watch?v=egq7Z...

Code:


t=int(input());
i=0;
while(i<t):
    a=int(input());
    rs=bin(a)[2:];
    y=list(rs);
    y.reverse();
    if('1' in y):
        io=y.index('1');
        print(io+1);
    else:
        print(0);
    i=i+1;


Telegram: https://t.me/clcoding_python 
https://www.facebook.com/pirawenpython/ 
https://www.facebook.com/groups/piraw...


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 (40) IS (25) Java (89) Leet Code (4) Pandas (1) PHP (20) Projects (19) Python (401) R (69) Selenium Webdriver (2) Software (14) SQL (27)