Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please do it in Python, ASAP! Exercise 10 Sally invited 17 guests to a dance party at her estate in the Hamptons. She assigned each
Please do it in Python, ASAP!
Exercise 10 Sally invited 17 guests to a dance party at her estate in the Hamptons. She assigned each guest a number from 2 to 18, keeping 1 for herself. At one point in the evening when everyone was dancing, Sally noticed the sum of each couple's numbers was a perfect square. Everyone was wearing their numbers on their clothing. The question is, what was the number of Sally's partner? Here's a reminder: a perfect square is attained by squaring, or multiplying by itself, an integer. So four is a perfect square of two. Nine is a perfect square of three. Sixteen is a perfect square of four. To identify a perfect square you should define a function that returns True if the parameter n is perfect or False otherwise. One approach is to calculate the square root of the number, then truncate that to an integer and square the resulting integer. If the final answer is the same as the original number (n) then n is a perfect square. With your function, we can derive all of the perfect numbers within a specific range. For example, the perfect squares between 2 than 30 would be 4, 9, 16, 25. Back to our dancing guests.... The dancing couple's numbers are adding up to either 4, 9, 16, 25, etc. And the question is, with the information you have available to you, what's the number of Sally's partner? Use python to calculate. Can you show all dancing couple pairs? [21]: ## your function definition here [ ]: ## your tests here [ ]Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started