Coder Social home page Coder Social logo

hackbright-intro-dictionaries's Introduction

Dictionary Practice

Fork and clone this repo

Make a fork, then make a local clone.

Start on the exercises

Complete these exercises in a file called dictionaries.py in this repo. Commit your work as you go!

  1. Create a dictionary called my_stats with your name, age, and height.
  2. Print out the string "[name] is [age] years old with a height of [height]." with [name], [age], and [height] coming from your dictionary.
  3. Delete your age from my_stats
  4. Create a dictionary called vocabulary_words that contains 4 vocabulary words from this course as keys and their definitions as values. (Hint: Look up at the wall if you can't think of any vocabulary words.)
  5. Write a program that counts how many times each letter appears in your full name. Return a dictionary that looks like this: {'a':2, 'c':1, 'w':1}
  6. Write a program that counts how many times each letter appears in a random string. Return a dictionary that looks like this: {'a':22, 'c':14, 'r':19, 'w':2}
  7. Write a program that counts how many times each letter appears in a file. Use the file one_fish_two_fish.txt in this repo to test your program. Return a dictionary.
  8. Write a program that counts how many times each word appears in a random string. When given "one fish two fish red fish blue fish" it should return a dictionary that looks like this: {'one':1, 'fish':4, 'two':1, 'red':1, 'blue':1}
  9. Write a program that counts how many times each word appears in a file. Use the file one_fish_two_fish.txt in this repo to test your program. Return a dictionary.
  10. Given a dictionary of items and their prices, write a program that returns the most expensive item. Hint: Look at the last slide in Dictionary Lecture to figure out how to iterate over a dictionary!

e.g. prices = { "banana": 4, "apple": 2, "orange": 1.5, "pear": 3 }

Your program should return "bananas"

Push your changes

Remember to commit and push all your changes!

hackbright-intro-dictionaries's People

Contributors

maxmi avatar salogel42 avatar sdspikes avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.