0

Hello how can I make a list of numbers that will increase by an x amount until the range is complete. Like I want set = [i for i in range(2,11)] I want the contents of list to be increase by 0.1, so its contents are going to go like [2, 2.1, 2.2, 2.3...... etc.].

Also how can I only print the contents of set1 of elements from the code below. instead of the outputs being (2, 1, 1) (2, 1, 2) (2, 2, 1) (2, 2, 2) (3, 1, 1) (3, 1, 2) (3, 2, 1) (3, 2, 2) it would be(2) (2) (2) (2) (3) (3) (3) (3). Thanks for the help :)

import itertools
set1 = [i for i in range(2,4)]
set2 = [i for i in range(1,2)]
set3 = [i for i in range(1,2)]

            
list_set = [set1, set2, set3]
for element in itertools.product(*list_set):
  print(element)
  • 2
    Does this answer your question? [How to use a decimal range() step value?](https://stackoverflow.com/questions/477486/how-to-use-a-decimal-range-step-value) The other answers there also include using `range` with a multiplier to get the results needed. – aneroid Dec 13 '20 at 07:42
  • please ask only one question in a SO post – Akshay Sehgal Dec 13 '20 at 07:46

0 Answers0