Hello There i am working on python project for my python course project so i need to get number from users so enter image description here
here is my test codes but the output is like that enter image description here
i want to store my imput datas like this one [2] not like this ['2'] what can i do for solve this. Thanks for help
by declaring new variable as input and without declaring what type it is, python will adress the variable as
string
. you will need to convert your variable:yinp= int(input("enter your number")
请尝试以下方法:
Explanation: By default python will take the inputs as
string
, you need to convert it to required type. In this case you need to convert intointeger
,int()
is helpful for you.