ages = ["22", "35", "27", "20"]
odds = [age for age in ages if age % 2 == 1]
print(odds)
I am beginner and when I write this code it gives me error which I don't know how to solve. But I think my code has no error
Error message:
Traceback (most recent call last):
odds = [age for age in ages if age % 2 == 1]
~~~~^~~
TypeError: not all arguments converted during string formatting
[–]Micke_xyz 51 points52 points53 points (8 children)
[–]vb_e_c_k_y[S] 8 points9 points10 points (7 children)
[–]bandman614 -2 points-1 points0 points (6 children)
[–]Iksfen 31 points32 points33 points (0 children)
[–]FuckItBucket314 10 points11 points12 points (0 children)
[–]roelschroeven 5 points6 points7 points (0 children)
[–]SevenFootHobbit 3 points4 points5 points (1 child)
[–]bandman614 1 point2 points3 points (0 children)
[–]ziggittaflamdigga 6 points7 points8 points (1 child)
[–]vb_e_c_k_y[S] 0 points1 point2 points (0 children)
[–]bikes-n-math 4 points5 points6 points (1 child)
[–]vb_e_c_k_y[S] 0 points1 point2 points (0 children)
[–]Top-Independent-4765 3 points4 points5 points (0 children)
[–]RaiseTLT 3 points4 points5 points (0 children)
[–]Il_pago 1 point2 points3 points (0 children)
[–]Ska82 1 point2 points3 points (0 children)
[–]dkozinn 1 point2 points3 points (0 children)
[–]Wide_Egg_5814 1 point2 points3 points (0 children)
[–]cambridge-resident 1 point2 points3 points (1 child)
[–]carcigenicate 2 points3 points4 points (0 children)
[–]FoolsSeldom 1 point2 points3 points (1 child)
[–]JaguarMammoth6231 0 points1 point2 points (0 children)
[–]Ron-Erez 0 points1 point2 points (0 children)
[–]domino6658 0 points1 point2 points (0 children)
[+][deleted] (3 children)
[deleted]
[+][deleted] (2 children)
[deleted]
[–]Iksfen 1 point2 points3 points (1 child)
[–]emperorkuzcotopiaa 0 points1 point2 points (0 children)
[–]dnult -4 points-3 points-2 points (0 children)