Write a Python Program to Parse a String to Float or Integer

Publié le: 05 septembre 2022
sur la chaîne: Code With TJ
599
1

Hi, Happy Teachers Day,

In this video you will learn about how to Write a Python Program to Parse a String to Float or Integer


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

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

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


Code
===========
"""
Write a Python Program to Parse a String to Float or Integer
"""

my_string = input("Enter a String / Float / Integer : ")
try:
value = int(my_string)
except ValueError:
try:
value = float(my_string)
except ValueError:
print("Given String cannot be parsed to Float or Integer")
else:
print("Given String is a float ", value)
else:
print("Given string is a Integer", value)

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 Parse a String to Float or Integer durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Code With TJ 05 septembre 2022, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 599 fois et il a aimé 1 téléspectateurs. Bon visionnage!