Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,900 questions

51,831 answers

573 users

How to check if the starting digit are similar in a list of numbers in Python

2 Answers

0 votes
lst = [3, 336, 3908899, 3126, 377] 
  
result = len(set(sub[0] for sub in  map(str, lst))) == 1
   
print(result) 
      
 
        
'''
run:
 
True
        
'''

 



answered May 2, 2020 by avibootz
0 votes
lst = [3, 336, 3908899, 3126, 4377] 
  
result = all(str(i)[0] == str(lst[0])[0] for i in lst) 
   
print(result) 
      
 
        
'''
run:
 
False
        
'''

 



answered May 2, 2020 by avibootz
...