1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
zubka84 [21]
3 years ago
11

Write a function flush that takes as input a list of five cards, tests whether it is a flush (Note: straight flush is not a flus

h!) and return a boolean value. If the entry is anything other than five distinct cards, it should return (not print!) the message "This is not a valid poker hand".
Computers and Technology
1 answer:
melamori03 [73]3 years ago
5 0

Answer:

Explanation:

ef poker(hands):

   scores = [(i, score(hand.split())) for i, hand in enumerate(hands)]

   winner = sorted(scores , key=lambda x:x[1])[-1][0]

   return hands[winner]

def score(hand):

   ranks = '23456789TJQKA'

   rcounts = {ranks.find(r): ''.join(hand).count(r) for r, _ in hand}.items()

   score, ranks = zip(*sorted((cnt, rank) for rank, cnt in rcounts)[::-1])

   if len(score) == 5:

       if ranks[0:2] == (12, 3): #adjust if 5 high straight

           ranks = (3, 2, 1, 0, -1)

       straight = ranks[0] - ranks[4] == 4

       flush = len({suit for _, suit in hand}) == 1

       '''no pair, straight, flush, or straight flush'''

       score = ([1, (3,1,1,1)], [(3,1,1,2), (5,)])[flush][straight]

   return score, ranks

>>> poker(['8C TS KC 9H 4S', '7D 2S 5D 3S AC', '8C AD 8D AC 9C', '7C 5H 8D TD KS'])

'8C AD 8D AC 9C'

You might be interested in
You insert a comment in a worksheet by using a command on the ____ tab on the Ribbon.
8090 [49]

The correct answer to this question is the Review Ribbon.

In order to insert a comment you can insert one from the Review ribbon at the top. A faster way / shortcut to also insert a comment is to right click on the cell where you want to insert the comment. You can choose to insert a comment and then write the comment using this method, rather than trying to find the icon on the ribbon at the top.

3 0
3 years ago
A game developer is purchasing a computing device to develop a game and recognizes the game engine software will require a devic
ale4655 [162]

Answer: Server

Explanation:

Options include:

A.Laptop

B.Server

C.Game console

D.Workstation

A server is referred to as a computer that helps in the provision of services, data or resources to other systems over a particular network.

Since the game developer wants a computing device to develop a game and recognizes the game engine software will require a device with high-end specifications that can be upgraded, the server is the best option for this.

5 0
2 years ago
What's the maximum number of ad extensions that can show for a particular query or device at any given time?
krok68 [10]

Answer:

Four (4) extensions.

Explanation:

Go-ogle Ads can be defined as a strategic advertising platform designed and developed by Go-ogle for use over the internet. It can be used to display product listings, services and campaigns to any web user over the internet.

Basically, for those who are relatively new to the Go-ogle Ads, the company provides a feature known as the dynamic search ads which helps various users to easily run a successful ad campaign. Through the use of machine learning, a dynamic search ad allows phrases and titles associated with a website to be automatically indexed and presented as a landing page to any user who is searching with the keywords.

The maximum number of ad extensions that can show for a particular query or device at any given time is four (4) extensions. The Go-ogle Ad extension platform is designed to display all the ads simultaneously or co-trigger and as such, the maximum number of ad extensions that are displayed per query or device are four (4).

4 0
3 years ago
Explain why the process of sketching in engineering might resemble a loop or a cycle.
Valentin [98]

Answer:The process of sketching in engineering might resemble a loop because of the design process.

Explanation: The design process is a loop or cycle to improve a design. So, sketches will be shown to other engineers and they will improve on the design until it is effective and efficient.

6 0
3 years ago
Read 2 more answers
What do you consider to be audit evaluation areas?
skelet666 [1.2K]

Answer:

<em>communications</em><em>,</em><em>risk</em><em>,</em><em>systems</em><em>,</em><em>test</em><em>ins</em><em>,</em><em>procedures</em><em>,</em><em>interviews</em><em>,</em><em>documents</em><em>.</em>

Explanation:

The auditor considers many factors in determining the nature, timing, and extent of auditing procedures to be performed in an audit of an entity's financial statements. One of the factors is the existence of an internal audit function. fn 1 This section provides the auditor with guidance on considering the work of internal auditors and on using internal auditors to provide direct assistance to the auditor in an audit performed in accordance with generally accepted auditing standards.Note: When performing an integrated audit of financial statements and internal control over financial reporting, refer to paragraphs 16-19 of PCAOB Auditing Standard No. 5, An Audit of Internal Control Over Financial Reporting That Is Integrated with An Audit of Financial Statements, for discussion on using the work of others to alter the nature, timing, and extent of the work that otherwise would have been performed to test controls.

Roles of the Auditor and the Internal Auditors

<em>02 </em>

<h2><em>I</em><em> </em><em>HOPE</em><em> </em><em>THIS</em><em> </em><em>HELPS</em><em> </em><em>ALOT</em><em>!</em><em> </em><em>:</em><em>3</em></h2>

3 0
3 years ago
Other questions:
  • You've decided to use a subnet mask of 255.255.192.0 with your 172.17.0.0 network to create four separate subnets. The network I
    13·1 answer
  • Which tab provide text formatting features
    11·1 answer
  • What are the three default security levels within software restriction policies?
    12·1 answer
  • You are tasked with creating a mileage calculator to calculate the amount of money that should be paid to employees. The mileage
    5·1 answer
  • Greg is the network administrator for a large stadium that hosts many events throughout the course of the year. They equip usher
    7·1 answer
  • Project manager George is defining project management to his team. How should he define project management in one sentence?
    7·1 answer
  • Suppose that a 2M x 16 main memory is built using 256kB x 8 RAM chips and memory is word addressable, how many RAM chips are nec
    6·1 answer
  • 2. Select the things you can do when working with rows in columns in a spreadsheet:
    5·1 answer
  • How are keyboards applied in the real world
    13·1 answer
  • This is science I just couldn’t find it
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!