Quantcast

Got Homework?

Connect with other students for help. It's a free community.

  • across
    MIT Grad Student
    Online now
  • laura*
    Helped 1,000 students
    Online now
  • Hero
    College Math Guru
    Online now

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

canuckfan34 Group Title

Hi everybody: Can somebody explain to me how to remove() from a dictionary? I can delete but I can't figure out how to remove! d{'four':4,'five':5,'six':6,'seven':7} how do i remove the second key and value 'five':5 from this dictionary?

  • one year ago
  • one year ago

  • This Question is Open
  1. msmithhnova Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    There is del and pop. Delete and remove seem like the same thing to me but here is some code. >>> d={'four':4,'five':5,'six':6,'seven':7} >>> del d['five'] >>> d {'four': 4, 'seven': 7, 'six': 6} >>> item = d.pop('six') >>> d {'four': 4, 'seven': 7} >>> item 6

    • one year ago
  2. canuckfan34 Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    Thanks, I know how to pop() it, just in the book I was reading it says you can use remove(), but it doesnt explain how? So that's what I was trying to figure... I guess no one uses remove in dictionaries then, and I shouldnt worry about it?

    • one year ago
  3. msmithhnova Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    Yeah, these seem to be the standard options. I cannot find a remove function and dicts don't have a remove method. Lists on the other hand do have a remove method. May be an error in the book ... not sure.

    • one year ago
  4. canuckfan34 Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    Thanks, how long you been learning python msmithnova?

    • one year ago
  5. msmithhnova Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    Only since I started doing some online courses on edX and Coursera that required it. They started toward the end of September. So about 6.5 months, but I have also done C, SML, ruby, racket, rails, html, css, php, js, cuda, ai, cryptography, algorithms, mobile robots, game theory, algebra, calculus, physics and digital audio, video and photography online courses during that time as well. I've completed 5 courses on Edx and 14 courses on Coursera during that time so only part of it was dedicated to Python. I've been busy, lol.

    • one year ago
    • Attachments:

See more questions >>>

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.