Quick actions

cmd+k|ctrl+k

Navigation

Languages

buoi 2 - bai 6

Snippet info

Language

Python

Visibility

public

Author

cuongd10vt3

Created

2016-10-17T06:50:25Z

Updated

2016-10-17T06:50:34Z

#bai 6 -copy code from internet =))
s = "this is a string, let's find out the most common and least common charater"
max_letter = s[0]
min_letter = s[0]
max = s.count(s[0])
min = s.count(s[0])
for c in s:
    if c is not " ":
        if s.count(c) > max:
            max_letter = c
            max = s.count(c)
        if s.count(c) < min:
            min_letter = c
            min = s.count(c)

print ("chu cai xuat hien nhieu nhat la %s , voi %s lan" %(max_letter, max))
print ("chu cai xuat hien it nhat la %s , voi %s lan" %(min_letter, min))
INFO