Python converting string into number

–Python

I wanted to convert string into integer, it shoes error but if I do it the other way round it converts. Is this a fact or there is a way to convert strings into integers

//code goes here

y=“hello”
x=int(y)

//error shows
Traceback (most recent call last):
File “”, line 1, in
ValueError: invalid literal for int() with base 10: 'hello ’

What is your code? What does the error say? What are the different solutions you have tried?

Hello, Harshle.

Python has many methods to convert data types from one to another. They are very well known and documented.

I would suggest you try the fCC-recommended approach of “Read-Search-Ask”.

Suggested sites:
Official Python Docs
w3schools

I hope this helps