Python, from tuple to string
📁 список, кортеж, python
Given a tuple {""34"", ""76"", ""0"", ""532""} How to extract numbers from this tuple so that the output looks like this?
34, 76, 0, 532I only have thoughts about putting it into a list, then extracting it, but there are still quotes, how to get rid of them?
a = {""34"", ""76"", ""0"", ""532""}lst=[]for i in a: lst.append(i)print(lst)['532', '34', '0', '76' To get an odd number greater by one from an even number, apply bitwise OR with one: a|1. Then a regular loop from a to b with step 2:
a = int(input())b = int(input())for i in range(a|1, b+1, 2): # +1 so that b is included if it's odd print(i, end=' ') Log in to leave an answer