Problem Statement:
It’s very simple, we need to find the number of strings equal to each other, and that’s it. This was the technical intro to the problem. Now, let’s see the actual problem. We are given some names and we need to find the number of pairs that exist. A pair means two names are equal to each other.
Code to find Names and Nicknames in Python:
t = int(input('Enter number of test cases: ')) for i in range(t): n = int(input('\nEnter number of people: ')) names = [] for j in range(n): names.append(input('Enter new name: ')) count_ = [] for i in names: count_.append(names.count(i)) if max(count_)>1: print('Yes, there is 1 or more pair(s) exist') else: print('No pair exist')
Output:

Also Read:
- Hyphenate Letters in Python
- Earthquake in Python | Easy Calculation
- Striped Rectangle in Python
- Perpendicular Words in Python
- Composite Number in Python
- Greatest Among Four Numbers in Python
- Reverse the sentence in Python
- Denominations in Python
- Min and max values in an array in JavaScript
- Keyboard events in JavaScript
- Reaching Ground Floor in Python
- Number of Moves in Python
- Starks Adventure in Python
- Neutralization in Python | Assignment Expert
- Free shipping in Python
- Raj has ordered two electronic items Python | Assignment Expert
- First Place in Python
- Triples with Properties in Python
- Nested list Indexing Python
- Team Points in Python
- Two words combination in Python
- ID Card in Python
- Cipher with a key in Python | Assignment Expert
- Multiple of 5 in Python
- Sandglass Star in Python
- Multiple of 3 in Python | Assignment Expert
- Ticket selling in Cricket Stadium using Python | Assignment Expert
- Sum of List Elements in Python
- All possible subsets in Python
- Names and Nicknames in Python