### Thread: How to give a value to numbers of a string?

1. No Profile Picture
Registered User
Devshed Newbie (0 - 499 posts)

Join Date
May 2013
Posts
19
Rep Power
0

#### How to give a value to numbers of a string?

Every string contains different numbers but this is an example of one.

(number1,number2,number3,number4,number5,number6,) = [2 ,1 ,7 ,30,39,51,]

I can print the number1 to number6 separated but I can not calculate with them because they have the value 0.
How can I calculate with their real value?

Thanks
2. Originally Posted by Filip.V
Every string contains different numbers but this is an example of one.
I don't see any string here in your question. You just initialize six integer numbers
python Code:
(number1,number2,number3,number4,number5,number6,) = [2 ,1 ,7 ,30,39,51,]

Originally Posted by Filip.V
I can print the number1 to number6 separated but I can not calculate with them because they have the value 0.
I don't understand what do you mean by 'They have the value 0'
python Code:

>>> (number1,number2,number3,number4,number5,number6,) = [2 ,1 ,7 ,30,39,51,]
>>> number1
2
>>> number2
1
>>> number3
7
>>> number4
30
>>> number5
39
>>> number6
51
>>> (number1 + number6) * number4
1590
>>> type(number1)
<type 'int'>
>>>
3. No Profile Picture
Registered User
Devshed Newbie (0 - 499 posts)

Join Date
May 2013
Posts
19
Rep Power
0
I did something wrong but now I can calculate with it.Thanks