The number of replications of the character in the string
Write a function that returns the number of repetition of a character in a string
You should not use ready -made functions for this question
count_char("hooshang", "o") #2
Write a function that returns the number of repetition of a character in a string
You should not use ready -made functions for this question
count_char("hooshang", "o") #2
let msg = 'error' alert(msg)This answer is only visible to premium members
This answer is only visible to premium members
let msg = 'error' alert(msg)This answer is only visible to premium members
This answer is only visible to premium members
let msg = 'error' alert(msg)This answer is only visible to premium members
This answer is only visible to premium members
```def duplicate_string(string,char): """ این تابع برای نشان دادن تعداد حروف تکراری در یک استرینگ است """ # Wear the variable value zero and the desired string with the circle count = 0 for i in string : if i == char: # If the characters in the navigation were one with our second entrance count += 1 # Add one number to Kant return count # Print out the output # Frequently function and give two inputs to the function filter_char = duplicate_string("mohammad","m") print(filter_char)```
function count_1(s, c) { let count = 0; for (let char in s) { if (char === c) { count += 1; } } return count; } const result = count_1("h", "o"); console.log(result);
def count_char(txt,char): count=0 for i in t: if c==i: count+=1 print(count if count>0 else 'nout found') t=input('enter your text: ') c=input('enter your char: ') count_char(t,c)
def string_txt(s): my_text = {} for item in s: if item in my_text: my_text[item] += 1 else: my_text[item] = 1 return my_text
def chek_try_str(string,char): return string.count(char) text=input('input one string:') char=input('input char for count:') print(f"the character appears'{char}',{chek_try_str(text,char)} times in the string.")
def count(x,y): l=[] for i in x: l.append(i) l2=filter(lambda x : True if x==y else False , l) return len(list(l2)) print(count('hooshang',"o")) #2
# Number def count_char(string, char): return string.count(char) print(count_char("hooshang", "o"))
Submitting answers is currently unavailable.
Write a program that prints an integers in the output. Get the desired interval from the input.
Write a function that receives a string and checks all the letters. If all the letters of the string were small, otherwise False would return
Write a program that receives a text and a word from the user, search the word in the text, and as the example below and then put the word * and print the text in the output. Example: Input1: Hello. My name is hooshang. I ...
برای استفاده از این بخش باید وارد حساب کاربریت بشی
ورود/ثبت نام If you don’t understand the exercise or can’t solve it for any reason, that’s completely
normal—don’t worry 😊
Try checking out easier exercises and reviewing different answers
submitted by others. Gradually, you can move on to more challenging exercises. Also, your answer
might be correct even if it’s different from others.