0
Gan i have your help I'm having trouble with this
You are making a program to analyze text. Take the text as the first input and a letter as the second input, and output the frequency of that letter in the text as a whole percentage. Sample Input: hello l Sample Output: 40 The letter l appears 2 times in the text hello, which has 5 letters. So, the frequency would be (2/5)*100 = 40.
24 Respuestas
+ 19
text=input()
letter=input()
x=text.count(letter)
print(int((x/len(text))*100))
This also gives correct output!!!!
+ 8
#your code goes here
string = input("")
string1 = input("")
number = 0
i = string1
for i in string:
if i == string1:
number += 1
#print(number)
len = len(string)
calc = number/len*100
print(int(calc))
#Thia code worked for me I hope that this helps You
+ 3
Answer
text = input()
letter = input()
text_count = 0
letter_count = 0
for i in text:
text_count += 1
for i in text:
if letter == i:
letter_count += 1
letter_percentage = (letter_count/text_count)*100
print(int(letter_percentage))
+ 2
like (:
text = input("") # hello
letter = input("") # l
count = text.count(letter) # 2
length = len(text) # 5
calculate = (count / length) * 100
print(int(calculate))
+ 1
#your code goes here
string = input("")
string1 = input("")
number = 0
i = string1
for i in string:
if i == string1:
number += 1
#print(number)
len = len(string)
calc = number/len*100
print(int(calc))
for any answer follow me on sololern
+ 1
string = input("")
string1 = input("")
count = 0
i = string1
for i in string:
if i == string1:
count+=1
length = len(string)
freq = (count/length)*100
print(int(freq))
try to get this code ;) , it is easy
HAPPY LEARNING :)
+ 1
x = input()
y = input()
#length of full character
full = len(x)
#counting how many times the character has appeared
single = (x.count(y))
print(int((single/full)*100))
# this code will give you the perfect output
+ 1
text = input()
letter = input()
Freq = text.count(letter)
ltext = len(text)
Frequency = int((Freq / ltext) * 100)
print(Frequency)
+ 1
text=input()
letter=input()
count=text.count(letter)
lenght=len(text)
print(int(count/lenght*100))
0
Please post your attempt also.
0
try this code it works for me
word = input()
char = input()
result = (word.count(char)/len(word))*100
print(int(result))
0
string = input()
letter = input()
count = 0
string = string.upper()
letter = letter.upper()
for i in string:
if i == letter :
count += 1
frequency = int((count/len(string))*100)
print(frequency)
This is the answer and you can take out the two lines after count if you want to. They are redundant. However, I used it to make it a perfect code that returns no issue.
0
#your code goes here
str = input()
letter = input()
freq = (str.count(letter)/len(str))*100
print(int(freq))
0
#your code goes here
text = input()
letter = input ()
result = (text.count(letter)/len(text))*100
print (int(result))
0
text=input()
letter=input()
x=text.count(letter)
print(int((x/len(text))*100))
0
x = input()
y = input()
a = x.count(y)
b = len(x)
c = a/b*100
print(int(c))
0
This worked for me!
word = str(input())
letter = str(input())
count = word.count(letter)
print(int((count/len(word))*100))
0
x = str(input())
y = str(input())
print(int(x.count(y) / len(x) * 100))
0
try this solution
x = str(input())
y = str(input())
v = x.count(y)
w = len(x)
a = v/w
b = a*100
print(int(b))
0
x = input()
y = input()
print (int((x.count(y)*100/len(x))))
people like to overcomplicate things here