Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 991971
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T06:11:32+00:00 2026-05-16T06:11:32+00:00

I have defined a tuple thus: (slot, gameid, bitrate) and created a list of

  • 0

I have defined a tuple thus:
(slot, gameid, bitrate)

and created a list of them called myListOfTuples. In this list might be tuples containing the same gameid.

E.g. the list can look like:

[
   (1, "Solitaire", 1000 ),
   (2, "Diner Dash", 22322 ),
   (3, "Solitaire", 0 ),
   (4, "Super Mario Kart", 854564 ),
   ... and so on.
]

From this list, I need to create a dictionary of pairs – ( gameId, bitrate), where the bitrate for that gameId is the first one that I came across for that particular gameId in myListOfTuples.

E.g. From the above example – the dictionary of pairs would contain only one pair with gameId “Solitaire” : ("Solitaire", 1000 ) because 1000 is the first bitrate found.

NB. I can create a set of unique games with this:

uniqueGames = set( (e[1] for e in myListOfTuples ) )
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T06:11:33+00:00Added an answer on May 16, 2026 at 6:11 am

    For python2.6

    dict(x[1:] for x in reversed(myListOfTuples))
    

    If you have Python2.7 or 3.1, you can use katrielalex’s answer

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have defined a custom Sharepoint list for special attributes related to a software
I have defined a custom list template type for SharePoint . I install it
I have a list called 'optionlist' which may change length from day to day,
In one file called say 'data' I have some tuples: tuple1 = (1, 2,
So My problem is this, I have a query that uses Mysql User-defined variable
I have a tuple of tuples and I want to put the first value
I have a class WeightedArc defined as follows: class Arc(tuple): @property def tail(self): return
I have defined a custom Capistrano task that's supposed to run locally (on my
I have defined the following: public ICollection<Item> Items { get; set; } When I
I have defined a visual state in which a button has a glow effect.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.