#calculate percent of char in text
count = 0
def findalpha(text,yourchar):
count = 0
for i in text:
if i == yourchar:
count+=1
return count
text= input("write your text pls :")
char = input("write your char pls(like(a,b,c,d,...) :")
percent = 100*(findalpha(text,char)/len(text))
print("your char is {0},and its contain {2}percent of your text". format(char,round(percent,2)))
پیام #calculate percent of char in text
6 آوریل 2019در همان حوالی فید
Mاین پیام
M