Giter Site home page Giter Site logo

dict_basic_homework's Introduction

Welcome

Dictionary

Automated grading of homework assignments and tests

  • fork this repository
  • solve the task
  • commit with proper message

Problems

first_item

Given a dictionary, Return first item value.

Example 1:

Input: {'a': 1, 'b': 2}
Output: 1

last_item

Given a dictionary, Return last item value.

Example 1:

Input: {'a': 1, 'b': 2}
Output: 2

create_dictionary

Convert two lists into a dictionary

Example 1:

Input: key = [1, 2, 3] value = ["one", "two", "three"]
Output: {1: "one", 2: "two", 3: "three"}

Constraints:

  • len(key) == len(value)

count_all

Given a function that takes a string and calculates the number of letters and digits within it.

  • Tests contain only alphanumeric characters.
  • Spaces are not letters.
  • All tests contain valid strings.

Example 1:

Input: txt = "Hello World"
Output: { "LETTERS":  10, "DIGITS": 0 }

Example 2:

Input: txt = "python foundations 2022"
Output: {'LETTERS': 17, 'DIGITS': 4}

Constraints:

  • 0 <= len(txt) <= 10^5

oldest_person

Given a dictionary containing the names and ages of a group of people, return the name of the oldest person.

Example 1:

Input: people = {"Javohir": 22, "Sharof": 23, "Tolib": 34, "Rustam": 16}
Output: "Tolib"

Constraints:

  • 0 <= len(people) <= 10^5

cities_dict

Given a list of cities names, Return dictionary with keys ordered by city name.

Example 1:

Input: cities = ["Bukhara", "Khiva", "Namangan", "Samarkand", "Tashkent"]
Output: {0: "Bukhara", 1: "Khiva", 2: "Namangan", 3: "Samarkand", 4: "Tashkent"}

Constraints:

  • 0 <= len(cities) <= 10^5

Warning

  • don't copy other solutions or any solution
  • don't remove comments

dict_basic_homework's People

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.