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.
Suppose we have the following 2 tables Users-> name, idbooks-> User_id, id, name 1- Write a query that shows user-related books at No. 2- Write a query to user names a ...
Write a program that receives the square side length from the input and calculates its area of square area = a side of its own = a side of a power 2.
Write a program that, like a dice, prints a random number between 1 and 6 in the output with each time running
Write a function that receives the number of hours of employee work per month as a parameter and calculates the amount of employee salaries according to the formula below and returns each employee for 2 hours of work per month, per hour at 4 ...
Define a class of User that has a username, email and password and the following methods. Print: Print username and email in the output IS_Gmail: Check whether the user's email is Gmail and ...
برای استفاده از این بخش باید وارد حساب کاربریت بشی
ورود/ثبت نام 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.