plsssssss heeeeeelp


Step 1: Create a New LocoXtreme Python Program


Start by creating a new Python program in the LocoRobo Academy.


The logic we will add will occur between the activate and deactivate motor lines. Recall that the motors must be activated in order to properly set the RGB Lights.


W1. Add code to prompt the user three times. Once for each R, G, and B color value, with the output stored in variables R, G, and B respectively. However, each prompt should ask for a HEX value from 00 to FF. Write your code below.

Step 2: Using the Input

With the input hex values stored in variables, we need to convert the values to decimal for use with the LocoXtreme set_lights() command. Recall that the int() function with a base of 16 can convert a hexadecimal string into a decimal integer.

W2. Add code to convert each R, G, B value into decimal, storing the decimal value in the same respective R, G, and B variable. Write your code below.

Now that we have decimal values, we can pass them to the set_lights() command and pause to display the user-specified color.

W3. Call set_lights() using your three decimal color values. Include a sync_lights() call after to update the lights on the robot. Finally, add a time.sleep() call to make the lights display for a time before the robot disconnects.

Step 3. Slicing

In the Lesson Video and Student Guide, it was shown how a string of hex characters could be split using slicing. Rather than prompting the user for three separate hexadecimal color values, we can prompt them for a single string of all three sets concatenated together. For example, rather than a user inputting FF three times, they would input FFFFFF in a single prompt.

For this type of logic, it is assumed the length is always 6 characters. Therefore, the user needs to add a leading '0' if the value would otherwise be a single digit. For example, 'A' would be '0A'.

W4. Update your code to only prompt the user for a single 6-character hexadecimal string. Slice the values for R, G, and B from left to right in the string, before they are cast into decimals. Write your updated code section below.

Answers

Answer 1

The Program based on the information will be given below.

How to explain the program

# Prompt the user to input a 6-character hexadecimal string

inputs = input("Please enter a six-digit hexadecimal sequence (e.g. FFFFFF): ")

# Slice the R, G and B values separately from left to right in the string, adding a leading '0' if needed

R_value = int(inputs[0:2], 16)

G_value = int(inputs[2:4], 16)

B_value = int(inputs[4:6], 16)

# Call set_lights() with three decimal represented colors then sync_lights()

set_lights(R_value, G_value, B_value)

sync_lights()

# To make lights display longer before disconnecting, add a time delay  

time.sleep(5)

Learn more about program on

https://brainly.com/question/26642771

#SPJ1


Related Questions

Create a UML diagram for the card game Go Fish.

Answers

A UML diagram for the card game Go Fish is given below:

The UML Diagram

-------------------------

|        Player         |

-------------------------

| -hand: List<Card>     |

| -score: int           |

| +getPlayerName(): String|

| +getHand(): List<Card>|

| +getScore(): int      |

| +addCardToHand(card: Card): void|

| +removeCardFromHand(card: Card): void|

| +addToScore(points: int): void|

| +hasCard(rank: Rank): boolean|

| +getMatchingCards(rank: Rank): List<Card>|

| +askForCard(player: Player, rank: Rank): List<Card>|

| +goFish(deck: Deck): Card|

-------------------------

        |                  ^

        |                  |

        |------------------|

        |                  |

-------------------------  |

|         Card          |  |

-------------------------  |

| -rank: Rank           |  |

| -suit: Suit           |  |

| +getRank(): Rank      |  |

| +getSuit(): Suit      |  |

| +toString(): String   |  |

| +equals(other: Object): boolean|

| +hashCode(): int      |  |

-------------------------  |

        |                  ^

        |                  |

        |------------------|

        |                  |

-------------------------  |

|         Rank          |  |

-------------------------  |

| ACE                   |  |

| TWO                   |  |

| THREE                 |  |

| FOUR                  |  |

| FIVE                  |  |

| SIX                   |  |

| SEVEN                 |  |

| EIGHT                 |  |

| NINE                  |  |

| TEN                   |  |

| JACK                  |  |

| QUEEN                 |  |

| KING                  |  |

-------------------------  |

        |                  ^

        |                  |

        |------------------|

        |                  |

-------------------------  |

|         Suit          |  |

-------------------------  |

| CLUBS                 |  |

| DIAMONDS              |  |

| HEARTS                |  |

| SPADES               |  |

-------------------------  |

        |                  ^

        |                  |

        |------------------|

        |                  |

-------------------------  |

|         Deck          |  |

-------------------------  |

Read more about UML diagram here:

https://brainly.com/question/13838828

#SPJ1

List the rules involved in declaring variables in python . Explain with examples

Answers

In Python, variables are used to store values. To declare a variable in Python, you need to follow a few rules:

1. The variable name should start with a letter or underscore.

2. The variable name should not start with a number.

3. The variable name can only contain letters, numbers, and underscores.

4. Variable names are case sensitive.

5. Avoid using Python keywords as variable names.

Here are some examples of variable declaration in Python:

1. Declaring a variable with a string value

message = "Hello, world!"

2. Declaring a variable with an integer value

age = 30

3. Declaring a variable with a float value

temperature = 98.6

4. Declaring a variable with a boolean value

is_sunny = True

Compare and contrast the code of ethics of two professional organizations or regulatory bodies in computer science field. Analyze the similarities and differences between the codes, and discuss their implications for professional practice. Critically evaluate the strengths and weaknesses of each code and propose recommendations for improving ethical standards in the profession.

Answers

Ethical standards upheld in the computer science field are set forth by reputable professional organizations like ACM and AAAI.

How is this so?

Both these organizations advocate for values promoting honesty, integrity, privacy protection and respect towards every individual's dignity.

While focus on educational growth is central to the ACM code of ethics, more significant emphasis seems laid down by AAAI for researchers in artificial intelligence fields to consider broader society concerns related to potential impact with AI research practices.

The codes derive their strength from placing significant stress on ethical behavior and acknowledging the influence of technology on society.

Learn more about Ethical Standards;
https://brainly.com/question/28295890
#SPJ1

Other Questions
Gamma ray bursters are great distances from us, yet we receive tremendous amounts of energy from them. What accounts for this An archeological specimen containing 296.9 g of carbon has an activity of 45 Bq. How old is the specimen in yr Meena has a pair of blue jeans with the design below on its back pockets.6060Which of the following best describes the triangle with the given measures?OA. obtuse isosceles triangleOB. acute equilateral triangleOC. obtuse equilateral triangleOD. acute isosceles triangle Your classmate tells you they got 2 for the Rf value for acetoaminophen. What should you say to them A professor believes the students in a statistics class this term are more creative than most other students attending the university. A previous study found that students at the university had a mean score of 40 on a standard creativity test, and the current class has an average score of 47 on this scale with an estimated population standard deviation of 5. The standard deviation of the distribution of means is 1.30. If there were 16 students in the class, and the professor wanted to test the null hypothesis described in the scenario using the 5% level of significance, the cutoff t score would be: Samir and his wife, Judy, just had a baby a few days ago. He talks incessantly about how capable and intelligent his newborn is, claiming she will be the president of United States someday. What is likely to be the only accurate claim Samir makes about his newborn's abilities If in an attempt to correct an externality the government sets a Pigouvian tax too high, the equilibrium quantity will be: Select one: a. lower than the efficient quantity. b. zero. c. higher than the efficient quantity. d. equal to the efficient quantity When considering the disease known as German measles, even if a mother is not showing symptoms, she may still be able to transmit the _______ virus to the fetus. This can lead to significant birth defects. Question 15(Multiple Choice Worth 4 points)(02.01 LC)Which type of market includes the banking industry and investments like stocks and bonds?O Factor marketO Financial marketO Product market4O Primary market A method for tracking accounts receivable that matches specific invoices and payments from the customer is called a(n) ________ method. The EU began as a ________, which eliminates trade barriers between member countries and adopts a common external trade policy, but does not allow free movement of factors of production between member nations. For Problem 7.2, calculate the minimum cycle length and the effective green time for each timing stage (balancing v/c for the critical movements). Assume the lost time is 4 seconds per timing stage and a critical intersection v/c of 0.95 is desired Toni Morrison's "Recitatif" to be an experiment in blurring the lines between the races. In what ways is the story about socio-economic class? Please use and cite specific details from the short story. He tries to scan the crowd for his friend. Research tells us that: A. Jason can scan for both colors at the same time. B. Jason can only scan for one color at the same time. In addition to direct evaluations, systems developers must identify and document indirect expenses that contribute to the _____. Pension plan assets were $300 million at the beginning of the year. The return on plan assets was 5%. At the end of the year, retiree benefits paid by the trustee were $13 million and cash invested in the pension fund was $17 million. What was the amount of the pension plan assets at year-end During pregnancy, the hypothalamus causes ______ secretion so a woman will be prepared to lactate after giving birth Madeline is highly concerned with her weight and has been engaging in a binge/purge cycle twice a month for the past two months. According to the DSM-5 criteria, she will most likely meet the criteria for More precise measurements indicate that some amount of Aga is also adsorbed onto the Teflon surface, but the total green fluorescence intensity from the entire Teflon area is only 5% of what is measured from the electrode area. How would this modify the result A race is an ethnic group Multiple choice question. with uniform physical characteristics. with a common culture. that goes unrecognized. believed to have a biological basis.