Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 {} from dict suppressing
Hi, little issue. Could u please tell me how to remove the {} between each number and "0" in the output of the console ? Thanks!

def fonction2_bis(n,a,b):
    import random
    r= random.randint(a,b)
    for i in range(n):
        r= random.randint(a,b)
    for item in L:
        dict={str(item): "\""+str(0) +"\""}
    print("There are",(len(L)), "items")
    return L2
>>> fonction2_bis(5,1,2)
There are 5 items
[{'2': '"0"'}, {'2': '"0"'}, {'2': '"0"'}, {'2': '"0"'}, {'1': '"0"'}]
Big Grin
you created dictionaries in step 10.
I would think you'd want to show them.
show what you want to see in the output
(Nov-11-2019, 12:02 AM)Larz60+ Wrote: show what you want to see in the output
Just reiterating this point, because we'd genuinely like to help!
Feel like you're not getting the answers you want? Checkout the help/rules for things like what to include/not include in a post, how to use code tags, how to ask smart questions, and more.

Pro-tip - there's an inverse correlation between the number of lines of code posted and my enthusiasm for helping with a question :)

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Sort a dict in dict cherry_cherry 4 230 Apr-08-2020, 12:25 PM
Last Post: perfringo

Forum Jump:

Users browsing this thread: 1 Guest(s)