Below you can find a program code that is supposed to take a phone number as an input and extract the country code from it. At first glance, the code is perfect, but it raises an error. Can you spot the issue?
Python unpacking operators (* and **)
What is wrong with the code?
Report a typo
Sample Input 1:
+12345678900Sample Output 1:
Country code: 1Write a program in Python 3
phone = input()
phone = sign, code, *rest
print('Country code:', code)
___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.