- Single Parameter 1 Write A Function Print Digit Which Takes A Single String Parameter Prints All Characters That A 1 (41.18 KiB) Viewed 46 times
Single parameter 1. Write a function print_digit() which . takes a single string parameter .prints all characters that a
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
Single parameter 1. Write a function print_digit() which . takes a single string parameter .prints all characters that a
Single parameter 1. Write a function print_digit() which . takes a single string parameter .prints all characters that are decimal digits, i.e. 0 - 9 def print_digit(a_string): - # complete the body of this function print_digit('24 hours in 1 day, 7 days in a 1 week.) message = 'I met a man with 7 wives. Each wife had 7 sacks.' print_digit(message) # output 2 4 1 71 > 7 7 2. Write a function print_even() which • takes a list of integer numbers as a parameter • prints all numbers that are even def print_even(a_list): # complete the body of this function print_even([1, 2, 3, 4, 5]) list_1 = (1, 3, 5, 7, 9, 11, 13, 15, 17, 20, 21, 20) list_2 - list(range(20, 0, -3)) print_even(list_1) print_even(list_2) # output >24 20 20 >20 14 8 2