Hello! So I have been practising some coding, however, there seems to be an error in my code. I have been trying to figure out what is wrong, however, I just can't seem to find it. There is no syntax error but, there seems to be a problem with my input. I am currently using repl.it and I am making a calculator. I would input something like "multiply" however, the calculator would only square. I have tried changing the variables but it just keeps coming back to the first "if" statement. I would appreciate some help.

Hello! So I Have Been Practising Some Coding, However, There Seems To Be An Error In My Code. I Have

Answers

Answer 1

Answer:

You OR expressions are wrong.

Explanation:

Rather than writing:

  if method == "Square" or "square":

You should write:

  if method == "Square" or method == "square":

The expression should evaluate to something that is true or false.

In the above case, the expression is method == "Square" or method == "square" which can are actually two sub-expressions with an or in between them:

subexpr1 or subexpr2

each of the sub-expressions should evaluate to true or false.

method == "Square" is one of those sub-expressions.

That is how an expression is broken down by the compiler.

TIP: If you would add method = method.lower() right after the input, you could simplify all the if statements by removing the uppercase variants.


Related Questions

lower cabinet is suitable for storing and stocking pots and pans true or false​

Answers

True.
Make sure cabinet is clean enough to put the pots and pans.

You should write the client so that it sends 10 ping requests to the server, separated by approximately one second. Each message contains a payload of data that includes the keyword PING, a sequence number, and a timestamp. After sending each packet, the client waits up to one second to receive a reply. If one second goes by without a reply from the server, then the client assumes that its packet or the server's reply packet has been lost in the network.Hint: Cut and paste PingServer, rename the code PingClient, and then modify the code. The two programs follow very similar process.You should write the client so that it starts with the following command:java PingClient host portwhere host is the name of the computer the server is running on and port is the port number it is listening to. Note that you can run the client and server either on different machines or on the same machine.The client should send 10 pings to the server. Because UDP is an unreliable protocol, some of the packets sent to the server may be lost, or some of the packets sent from server to client may be lost. For this reason, the client cannot wait indefinitely for a reply to a ping message. You should have the client wait up to one second for a reply; if no reply is received, then the client should assume that the packet was lost during transmission across the network. You will need to research the API for DatagramSocket to find out how to set the timeout value on a datagram socket.When developing your code, you should run the ping server on your machine, and test your client by sending packets to localhost (or, 127.0.0.1). After you have fully debugged your code, you should see how your application communicates across the network with a ping server run by another member of the class.Message FormatThe ping messages in this lab are formatted in a simple way. Each message contains a sequence of characters terminated by a carriage return character (r) and a line feed character (n). The message contains the following string:PING sequence_number time CRLFwhere sequence_number starts at 0 and progresses to 9 for each successive ping message sent by the client, time is the time when the client sent the message, and CRLF represent the carriage return and line feed characters that terminate the line.

Answers

Answer:

figure it out urself

Explanation:

Have you ever tried using such a camera?​

Answers

Answer: yeah i mean i use my canon camera

Explanation:

Other Questions
Please help!!!!!!!!!! What is the correlation between investing in human capital and literacy rate? help please!!!!!!!!! Who is the current prime minister of India If we _____a water at100c (heat),it _______(boils). Question #5Multiple ChoiceWhat is used within an HTML tag for additional information?O attributeO anchorO hyperlinkmetadata Community Supported Agriculture (CSA) is a government program in which tax dollars from a municipality are used to help local farms.TRUEFALSEPlease answer this question What number is missing from this factor tree for the prime factorization of 328?A.39B.41C.42D.82 Who sent the Christian army and what symbol did they wear? What does Peter feel when he sees Clarissa at the end of the novel?a. Excitementc. Ecstasyb. Terrord. All of the above the length of a room is 2 m longer than its breadth .if the area of its floor is 63 sq.m.calculate the length and the breadth of the room Which of Diocletian's economic changes helped bring short-term order to Rome?* He started a new coin system and expanded trade.He abolished coins and implemented a barter system.He minted more coins and allowed free markets.He standardized coins and established fixed prices. what system do scientist use to keep track of their studies HELP PLEASE!!Can someone help I have to write a poem about elephants!!! precalc! 50 points! please someone help me ill do anything for you Evaluate the expression. 6(3+5)/4 No explanation needed, just the answers for 1 to 4 please!Both circumference and area for all problems! Which of the following answers would haveno solution?X=35=32=2 Which term describes the surrounding area of this image? The surrounding area of this image is called Surroundings ForegroundBackground This area is also called aNegative Positive Neutral Find the measure of the indicated angle to the nearest degree.PLS URGENT HELP