Output answer in Tuple.....How can I get output in Tuple | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Output answer in Tuple.....How can I get output in Tuple

T=() tl = tuple(eval(input("Enter the tuple:"))) for i in tl: if i%2 !=0: print('-1', end =' ') else: print(i, end = ' ')

19th Feb 2021, 7:15 AM
Harsh Sinha
Harsh Sinha - avatar
1 Answer
+ 3
tpl = tuple(x if x % 2 == 0 else -1 for x in tuple(eval(input()))) print(tpl)
19th Feb 2021, 8:27 AM
ChaoticDawg
ChaoticDawg - avatar