
CODE IN PYTHON
In an alternate reality, chemistry Professors Hodge and Sibia have teamed up to design a chemical compound X such that when X is added to Dan’s favorite food (saltine crackers), it’ll make him despise it. For this, they are working with 6 kinds of extracts:
- Singleton Extracts: berries (B), green veggies (G), dairy (D)
- Combination Extracts: icecream (I), salad (S), and cheese sauce (C)
Like regular food, mixing two extracts of the same kind will result in an extract of the same kind (eg. mixing berries B with berries B will result in berries B).
Mixing two singleton extracts will result in a combination extract, using these rules:
- Berries (B) + Green Veggies (G) = Salad (S)
- Berries (B) + Dairy (D) = Icecream (I)
- Green Veggies (G) + Dairy (D)= Cheese Sauce (C)
Mixing two combination extracts will result in a singleton extract closest to them. For example, Icecream (I) + Salad (S) is closest to Berries (B) since both Icecream and Salad extracts require using Berry extracts according to the rules above.
Mixing any singleton extract with a combination extract will result in a Tasteless (T) extract. Combining the Tasteless extract with any extract will result in that extract. For example: Tasteless (T) + Salad (S) will result in Salad (S).
In the lab of cool chemicals, extracts are organized into an upside-down triangle, with each row containing one fewer extract than the row above. The top row has a capital letter in each cell representing the first letter of the extract stored there. Each of the cell extracts in the next row is found by mixing the extracts in the two cells above. For example, the first cell is the result of mixing the first two cells from the row above, the second cell is the result of mixing the second and third cells from the row above, and so on. This process continues until the bottom row. Given a string of letters for the top row, output the first letter of the extract in the bottom cell as an uppercase letter.
Input
- The first (and only) line will contain characters representing the extracts in the top row. (note: these can only be: B, G, D, I, S, and C).
Output
A single capital letter representing the extract in the bottom cell (B, G, D, I, S, C, or T).
Sample Input 1
CBGCCSD
Sample Output 1
T

Trending nowThis is a popular solution!
Step by stepSolved in 3 steps with 2 images

- in Javaarrow_forwardGiven two input integers for an arrowhead and arrow body, print a right-facing arrow. Ex: If the input is: 0 1 the output is: 1 11 00000111 000001111 00000111 11 1 import java.util.Scanner; public class LabProgram { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); int baseChar; int headChar; /* Type your code here. */ }}arrow_forwardConsider the following python code. What does it print when executed? x = 5 def foo(x): x += 2 return x def bar(): global x x += 5 return x def alpha(a, b): a = b * 3 return a def beta(alist): alist.append("hi") def main(): a = 3 b = 4 print(alpha(a, b), a) main() Question 3 options: 12 3 10 15 12 12 3 12arrow_forward
- Please can you help me solve this problem in Python. Darkening an image requires adjusting its pixels toward black as a limit, whereas lightening an image requires adjusting them toward white as a limit. Because black is RGB (0, 0, 0) and white is RGB (255, 255, 255), adjusting the three RGB values of each pixel by the same amount in either direction will have the desired effect. Of course, the algorithms must avoid exceeding either limit during the adjustments. Lightening and darkening are actually special cases of a process known as color filtering. A color filter is any RGB triple applied to an entire image. The filtering algorithm adjusts each pixel by the amounts specified in the triple. For example, you can increase the amount of red in an image by applying a color filter with a positive red value and green and blue values of 0. The filter (20, 0, 0) would make an image’s overall color slightly redder. Alternatively, you can reduce the amount of red by applying a color filter…arrow_forwardUsing p5* JavaScript on "openprocessing" websitearrow_forwardpython if we put a grid on the surface of Earth with a grid spacing of dx and dy in the longitude and latitude directions, respectively, the grid area (approximated as dx*dy) varies with latitude. Explain why that is.arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education





