Write a Python Program to Create a Dictionary From String

Published: 17 September 2023
on channel: 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


On this page of the site you can watch the video online Write a Python Program to Create a Dictionary From String with a duration of hours minute second in good quality, which was uploaded by the user Code With TJ 17 September 2023, share the link with friends and acquaintances, this video has already been watched 296 times on youtube and it was liked by 4 viewers. Enjoy your viewing!