Day 22 of 100 Days of Python Programming - Count Characters in a string

preview_player
Показать описание
Here is a Codewars python problem called Count Characters in a string, watch me how I tackle every problem.

The rule that I set for myself is

1. after 1 hour of programming and if I can't solve the problem I will look the answer and move on.
2. Only hints can aid me with problem but not the whole solution itself, because there are different solution to every problem.

Inspired by the 100 Days Python Challenge of Dr. Angela Yu
Рекомендации по теме
Комментарии
Автор

HELLO HERE
MY WAY OF SOLVING THE PROBLEM STATEMENT ABOVE IS
#asigning a string down below
string="todaytodayrayan"
#creating a list from the string
list1=[]
for i in string:
#assigning each character into an element in the new list and adding it to the list
list1.append(i)
#From here stay with me keenly
#k is asigned as 0 we will use and will be key important to
k=0
for i in list1:
count = 0
#the counter for each element in the list will begin as 0
for j in list1:
#this inner for loop checks if the element is repeated a couple of times
if j == list1[k]:
#this if statement aim is to count how many times the element has appeared
count += 1
k += 1
#this k here is an increament for the element that is checked above in the if statement
counter=count

#lets with 100 day python solving skills
#go go go

ErickBenson-gp
visit shbcf.ru