Python code for different programms
1 Write a function intreverse(n) that takes as input a positive integer n and returns the integer obtained by reversing the digits in n.
Here are some examples of how your function should work.
>>> intreverse(783)
387
>>> intreverse(242789)
987242
>>> intreverse(3)
3
2 Write a function matched(s) that takes as input a string s and checks if the brackets "(" and ")" in s are matched: that is, every "(" has a matching ")" after it and every ")" has a matching "(" before it. Your function should ignore all other symbols that appear in s. Your function should return True if s has matched brackets and False if it does not.
Here are some examples to show how your function should work.
>>> matched("zb%78")
True
>>> matched("(7)(a")
False
>>> matched("a)*(?")
False
>>> matched("((jkl)78(A)&l(8(dd(FJI:),):)?)")
True
3.Write a function sumprimes(l) that takes as input a list of integers and retuns the sum of all the prime numbers in l.
Here are some examples to show how your function should work.
>>> sumprimes([3,3,1,13])
19
>>> sumprimes([2,4,6,9,11])
13
>>> sumprimes([-3,1,6])
0