Question: should be done in python Imagine a customer in a bank is asked to enter a whole number representing their approximate monetary worth. In that

should be done in pythonshould be done in python Imagine a customer in a bank is

Imagine a customer in a bank is asked to enter a whole number representing their approximate monetary worth. In that case, some people use commas to separate thousands, millions etc, and some don't. In order to perform a some calculations the bank needs that number as na integer. Write a function, called casual_number (s) that has one parameter, s, as input where s is a string. Function casual_number (s) should return an integer representing a number in s. If s does not look like a number the function should return None. Note that if a string in s looks like a number but with commas, you may assume that commas are in meaningful places i.e. you may assume that s will not be a string like '1, 1,345' >>casual_number("251" 251 >>>casual_number("1,aba,251") >>>casual_number("1,251") 1251 >>>casual number("1251" 1251 >>> casual number("-97,251") 97251 >>casual_number("-97251") 97251 >>> casual number("- , ,,,") >>> casual number("--97,251") >>>casual_number("-") >>> casual_number("-1,000,001") -1000001 >>> casual_number ("999,999,999,876") 999999999876 >>>casual_number("-2") 2

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!