Re: [Tutor] Question about a python finction

2018-05-12 Thread Alan Gauld via Tutor
On 12/05/18 06:40, peter wrote: > range does not work the same for 2.7 and my 3.6.5. Seems they have > changed the nature of range. It is a built in listed along with lists > and tuples You are correct in that it has changed slightly and now returns a range object. but you can convert it to a

Re: [Tutor] Question about a python finction

2018-05-12 Thread peter
range does not work the same for 2.7 and my 3.6.5. Seems they have changed the nature of range. It is a built in listed along with lists and tuples list(range(10)) [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] >>> tuple(range(10)) (0, 1, 2, 3, 4, 5, 6, 7, 8, 9) seems they have changed range for

Re: [Tutor] Iteration issues

2018-05-12 Thread Peter Otten
Neil Cerutti wrote: > punctuation_removal_table = str.maketrans({c: None for c in > string.punctuation}) Alternative spellings: >>> from string import punctuation >>> (str.maketrans({c: None for c in punctuation}) ... == str.maketrans(dict.fromkeys(punctuation)) ... == str.maketrans("", "",