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_forwardDevelop a Java Application to play a game of guess the number from 1 - 100.arrow_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_forward
- Consider 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_forward1. Problem Description: The total nuclear binding energy is the energy required to split a nucleus of an atom in its component parts: protons and neutrons, or, collectively, the nucleons. It describes how strongly nucleons are bound to each other. When a high amount of energy is needed to separate the nucleons, it means nucleus is very stable and the neutrons and protons are tightly bound to each other. The atomic number or proton number (symbol Z) is the number of protons found in the nucleus of an atom. The sum of the atomic number Z and the number of neutrons N gives the mass number A of an atom. + Binding energy Separated nucleons (greater mass) Nucleus (smaller mass) Figure 1: Binding Energy in the Nucleus The approximate nuclear binding energy Eb in million electron volts, of an atomic nucleus with atomic number Z and mass number A is calculated using the following formula: 22 (А — 22)? , as Eb = a,A – azA3 – az- a4- A A3 AZ where, a, 15.67, az = 17.23, az = 0.75, a4 = 93.2 , and…arrow_forwardWrite a Java program to convert a colour image to a grayscale image by manipulating the pixel colour values. The Red : Green : Blue ratio should be set to 28:60:12.arrow_forward
- write the code in python pleasearrow_forwardWrite an Arduino program that simulates a robot car using: • Two gear motors (DC motors) • One motor driver • A servo motor The car should move forward, stop for a one second, and then move backward (this process should be repeated continuously). When the car is moving forward the servo motor should rotate from angle 0 to angle 180 and back from angle 180 to angle 0. When the car stops or is moving backward the servo motor should stop rotating. Hello i need the solution using arduino c language as soon as possiblearrow_forwardWrite the code in Java language The problem states that there are five philosophers sitting around a circular table. The philosophers must alternatively think and eat. Each philosopher has a bowl of food in front of them, and they require a fork in each hand to eat. However, there are only five forks available. You need to design a solution where each philosopher can eat their food without causing a deadlock.arrow_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_forwardWrite a program that displays a new larger circle with a left mouse click and removes the largest circle with a right mouse click, as shown in Figure 9.35.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