Money, money, money!

Report a typo

Imagine your friend has written a program that checks whether an input string is some monetary amount (in US dollars).
However, the program doesn't work the way it's expected to! Can you solve the issue?

Tip: + is a quantifier, it means ''the preceding character should appear one or more times".

Sample Input 1:

$30

Sample Output 1:

Amount found: $30
Write a program in Python 3
import re

string = input()
regex = r'$\d+'
match = re.match(regex, string)
if match:
print('Amount found: ', match.group())
else:
print('No match!')
___

Create a free account to access the full topic