Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 pythonimage text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Probabilistic Databases

Authors: Dan Suciu, Dan Olteanu, Christopher Re, Christoph Koch

1st Edition

3031007514, 978-3031007514

More Books

Students also viewed these Databases questions