Write a Python Program to Create a Dictionary From String

Publié le: 17 septembre 2023
sur la chaîne: Code With TJ
296
4

Hello Programmers, Welcome to my channel.

In this video you will learn about how to Write a Python Program to Create a Dictionary From String

Python Scripts
======================
https://codewithtj.blogspot.com/2024/...

Python Functions Solved
==========================
https://codewithtj.blogspot.com/2023/...

Python Programs Solved
============================
https://codewithtj.blogspot.com/2023/...


Code for word counter
=============================
input_string = input("Enter a String : ")
word_counter = dict()

for word in input_string.split():
if word in word_counter:
word_counter[word] += 1
else:
word_counter[word] = 1

for key, value in word_counter.items():
print(f"{key} has occured {value} times")


Code for char counter
=============================
string = input("Enter String : ")
char_counter = dict()

for char in string:
if char in char_counter:
char_counter[char] += 1
else:
char_counter[char] = 1

for key, value in char_counter.items():
print(f"Letter : {key} has occured : {value} times")

Keywords
=============================
#python #python3 #python_assignment #pythonprogramming #pythontutorial #pythonprojects #pythoncourse #pythonbaba #pythonforbeginners #pythonautomation #pythonbasic #pythonbeginners


Sur cette page du site, vous pouvez voir la vidéo en ligne Write a Python Program to Create a Dictionary From String durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Code With TJ 17 septembre 2023, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 296 fois et il a aimé 4 téléspectateurs. Bon visionnage!