0
def CountFrequency(z): 
  
    
    freq = {} 
    for item in z: 
        if (item in freq): 
            freq[item] += 1
        else: 
            freq[item] = 1
  
    for key, value in freq.items(): 
        a=(min(freq.values()))
        b=(max(freq.values()))
    return a,b

i want to print my output without brackets but it prints with ( )

eg -

expected :

1 2

output :

(1,2)
khelwood
  • 55,782
  • 14
  • 81
  • 108
  • 2
    `print(* CountFrequency(whatever))` - the * will decompose the list and then prints standard -`sep=" "` will take care of the space between 1 and 2 – Patrick Artner Sep 05 '20 at 21:53
  • See https://stackoverflow.com/questions/52097264/how-to-print-list-elements-in-one-line for some more explanations - works for list the same – Patrick Artner Sep 05 '20 at 21:57
  • @PatrickArtner damn how can i forget this concept. Thank you so much :) – Sankalp Raj Sep 05 '20 at 21:59
  • Can also do `' '.join(map(str, CountFrequency(z)))` if you want to construct the string but not necessarily print it. – Samwise Sep 06 '20 at 02:27

1 Answers1

4

The return type is of tuple type, therefore the parenthesis (it's their string representation).

To print tuple elements separated with spaces you can use the * operator:

t = a, b = 3, 5

print(*t)
Aviv Yaniv
  • 6,188
  • 3
  • 7
  • 22