Question: I want this code to be written in Python 3 Background Selection statements (if/elif/else combinations) allow us to write code that can execute different statements

I want this code to be written in Python 3I want this code to be written in Python 3 Background Selection

statements (if/elif/else combinations) allow us to write code that can execute different

Background Selection statements (if/elif/else combinations) allow us to write code that can execute different statements based on the current values seen in a particular run of the program. We will use this to write a program that performs calculations and selectively reports on different properties of the calculated values. Guidelines Think carefully about the order you will check different properties. You might want to write some pseudocode or perhaps draw a flowchart if this works better for you. Think first, then implement Be careful what kinds of selection statements you use, and be sure to test your code with many examples. For instance, multiple if statements will not necessarily behave the same as a chain of if-elif-elif. it When a specific test case isn't working, plug your code into the visualizer to watch what the code does, which lines run, which branches are taken. From built-in functions, you are allowed to call int(), float(), str() on You are not allowed to import anything. You are not allowed to use loops or any feature that hasn't been covered in class yet Don't forget to review the "assignment basics" file Insert comments in the lines you deem necessary (hint: more than 0 are necessary) gurcune vulcuions you must implement: intervals_relation (A_start, A_end, B_start, B_end) Description: The function checks whether intervals A and B have an overlap and returns a value that indicates what kind of overlap this is. Parameters: A_start(int) and A_end (int) are the left and right limits of interval A, while B_start (int) and B_end (int) are the left and right limits of interval B respectively. All values are inclusive (i.e. intervals are closed from both ends). Parameters A_start and A_end are guaranteed to be in order (the same holds for parameters B_start and B_end), but this doesn't mean that interval A is necessarily positioned before interval B. ti Return value: If the two intervals do not overlap you return 0. If one is enclosed entirely by the other you return 1. If there is a partial overlap you return-1. The return value is always an int. Examples intervals_relation(1,8,2,8 intervals_relation(3,7,-1,2) intervals relation (4,5,-2,4) sphere_quadrant(x,y,z) Description: Given the three coordinates of a 3D point decide what quadrant of a sphere this point lies in. The sphere (depicted in Figure 1) is centered on the origin (0,0,0) and has a radius of 1. Parameters: x (float), y (float), z (float) are the coordinates of the 3D point. All three parameters are guaranteed to have non zero values. Return value: The color of the quadrant the 3D point lies in as a string containing one of the following values: blue, green, brown, magenta. Moreover, if the 3D point lies beneath the surface (ie the XY nlane you see in the figure), prepend the above string with the string "lower". Last, if the 3D point lies Background Selection statements (if/elif/else combinations) allow us to write code that can execute different statements based on the current values seen in a particular run of the program. We will use this to write a program that performs calculations and selectively reports on different properties of the calculated values. Guidelines Think carefully about the order you will check different properties. You might want to write some pseudocode or perhaps draw a flowchart if this works better for you. Think first, then implement Be careful what kinds of selection statements you use, and be sure to test your code with many examples. For instance, multiple if statements will not necessarily behave the same as a chain of if-elif-elif. it When a specific test case isn't working, plug your code into the visualizer to watch what the code does, which lines run, which branches are taken. From built-in functions, you are allowed to call int(), float(), str() on You are not allowed to import anything. You are not allowed to use loops or any feature that hasn't been covered in class yet Don't forget to review the "assignment basics" file Insert comments in the lines you deem necessary (hint: more than 0 are necessary) gurcune vulcuions you must implement: intervals_relation (A_start, A_end, B_start, B_end) Description: The function checks whether intervals A and B have an overlap and returns a value that indicates what kind of overlap this is. Parameters: A_start(int) and A_end (int) are the left and right limits of interval A, while B_start (int) and B_end (int) are the left and right limits of interval B respectively. All values are inclusive (i.e. intervals are closed from both ends). Parameters A_start and A_end are guaranteed to be in order (the same holds for parameters B_start and B_end), but this doesn't mean that interval A is necessarily positioned before interval B. ti Return value: If the two intervals do not overlap you return 0. If one is enclosed entirely by the other you return 1. If there is a partial overlap you return-1. The return value is always an int. Examples intervals_relation(1,8,2,8 intervals_relation(3,7,-1,2) intervals relation (4,5,-2,4) sphere_quadrant(x,y,z) Description: Given the three coordinates of a 3D point decide what quadrant of a sphere this point lies in. The sphere (depicted in Figure 1) is centered on the origin (0,0,0) and has a radius of 1. Parameters: x (float), y (float), z (float) are the coordinates of the 3D point. All three parameters are guaranteed to have non zero values. Return value: The color of the quadrant the 3D point lies in as a string containing one of the following values: blue, green, brown, magenta. Moreover, if the 3D point lies beneath the surface (ie the XY nlane you see in the figure), prepend the above string with the string "lower". Last, if the 3D point lies

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!