How to assign value int avlue to string in python?
Answers
Answered by
0
I'm working in Python and I have a list of integers: [1, 2, 1, 3, 2, 2, 1, 3].
I want to assign each integer a string as if it were a variable: ['red', 'orange', 'red', 'yellow', 'orange', 'orange', 'red', 'yellow'].
How would I go about doing this?
In that example, 1 corresponds to 'red', 2corresponds to 'orange', and 3 corresponds to 'yellow'.
I want to assign each integer a string as if it were a variable: ['red', 'orange', 'red', 'yellow', 'orange', 'orange', 'red', 'yellow'].
How would I go about doing this?
In that example, 1 corresponds to 'red', 2corresponds to 'orange', and 3 corresponds to 'yellow'.
Similar questions
Chemistry,
7 months ago
English,
7 months ago
Social Sciences,
1 year ago
Math,
1 year ago
Chemistry,
1 year ago