Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize palindromes in python

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

How to achieve palindromes in python, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.

Def sum (a): s=len (str (a)) if slots 5: sum= int (str (a) [0]) + int (str (a) [1]) + int (str (a) [2]) + int (str (a) [3]) + int (str (a) [4]) return sumif s==6:sum = int (str (a) [0]) + int (str (a) [1]) + int (str (a) [2]) + int (str (a) [3]) + int (str (a) [4]) + int (str (a) [5]) return sumdef sum_1 (a): s=len (str (a)) if slots 5: sum= a+a//10+a//100+a//1000+a//10000 return sumif s==6:sum = a+a//10+a//100+a//1000+a//10000+a//100000return sumdef sum_2 (a): sum=0for i in range (len (str (a)): sum+=int (str (a) [I]) return sumn=int (input ()) for i in range (10000) 1000000): if str (I) = = str (I) [::-1] and n = = sum_2 (I): print (I) is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report