Question
Write a program that determines if a string (passed as a command-line argument) has all unique characters. The program must print the number of times
Write a program that determines if a string (passed as a command-line argument) has all unique characters. The program must print the number of times each existing character appears, and then print whether or not they are all unique.
C:\>python unique.py
Usage: python unique.py "Any string you want..."
C:\>python unique.py This is a string!
Usage: python unique.py "Any string you want..."
C:\>python unique.py "This is a string!"
T : 1
h : 1
i : 3
s : 3
: 3
i : 3
s : 3
: 3
a : 1
: 3
s : 3
t : 1
r : 1
i : 3
n : 1
g : 1
! : 1
Not unique! One or more characters appear more than once.
C:\>python unique.py "My string!"
M : 1
y : 1
: 1
s : 1
t : 1
r : 1
i : 1
n : 1
g : 1
! : 1
Unique! All characters appear only once.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started