Question: Solve thhs using pyhton 1 flrite a function called average inta average inta mould Thave one parameter, a string. The atring will be made of:
1 flrite a function called average inta average inta mould Thave one parameter, a string. The atring will be made of: thimalipiple types of characters. faverage int:s should return the average (rounded to one fdecimal. place) of on ly the integer characters in the string. for example: - average ints( "abc123") 2.0, the average of 1,2, and 3 - average ints ("g25fsdv 42f21m, ,2.7, the average of 2,5,5, 4,21 , and 1 , rounded to the nearest tenth. Fyou may assume there will be at least one integer in the Fisting. Count only the integers when calculating the average. * Remember, you can round a number to one decimal point with *round (the num, 1). Write your function herel *Below are some lines of code that will test your function. *You can change the value of the variable(s) to test your \#function with different inputs. *If your function works correctly, this will originally \#print: H2.0 \#2. 7 * 1.0 print (average ints ("abc123")) print (average ints("g25fsdv42v21")) print (average ints ("abc1def"))
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
