python与平台有关吗_后端开发
Python与平台无关,因为Python是跨平台的语言,Python作为脚本语言,是解释执行的,所以能跨平台,前提是必须要有一个对应的解释器。
具体请看实例:
python中count函数的用法详解_后端开发
python中count函数用于统计字符串里某个字符出现的次数,语法为str.count(“char”,start,end)。比如使用“aabbcc”.count(“b”)可以获得“b”在字符串“aabbcc”中出现的次数。
免费视频教程推荐:c语言视频教程
#include
#include
#include
char *right(char *ms,int len); /*截取一个字符串尾部长为len个字符的子串*/
void main()
{
long a;
int len;
char as[10];
char ms[20];
printf("求[1,10000]中的同构数:\n");
for(a=1;a<=10000;a++)
{
ultoa(a,as,10); /*数a转换为字符串,存入as*/
len=strlen(as);
ultoa(a*a,ms,10);
if(strcmp(as,right(ms,len))==0) /*比较字符串as与ms长为len的子串是否相等*/
printf("%s 其平方为 %s\n",as,ms); /*相等就是同构数,输出结果*/
}
system("pause");
}
char *right(char *ms,int len) /*截取字符串尾部长为len子串的函数*/
{
int i,j;
for(i=0;i
for(j=0;j
return ms;
}
相关文章教程分享:c语言教程