def result(): #定义一个函数 string_str=input("请输入一个字符串:") intCount1=0 intCount2= 0 for i in string_str: if i.isdigit(): #判断当前字符是不是数字 intCount1 +=1 # print(intCount1) if i.islower(): #判断当前是字符是不是小写字符 intCount2 += 1 print(intCount2) #可不要 print(intCount1) #可不要 if(intCount1!=0 and intCount2 !=0): #若是二者都不不为0 print("true") # print("true") else: print("false") result()#调用函数
本文分享 CSDN - 吹牛派第一高手之高高手。
若有侵权,请联系 support@oschina.cn 删除。
本文参与“OSC源创计划”,欢迎正在阅读的你也加入,一块儿分享。git