Question

Exercise 5.3. If you are given three sticks, you may or may not be able to arrange them in a triangle. For example, if be abl

need help with excercise 5.3

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Ans 1:-

def is_triangle(x,y,z):

if(z>(x+y)):

print ("No")

elif(y>(x+z)):

print ("No")

elif(x>(z+y)):

print ("No")

else:

print ("Yes")

Ans 2 :-

def triangle():

x = int(input('Please enter the length of the 1st stick:\n'))

y = int(input('Please enter the length of the 2nd stick:\n'))

z = int(input('Please enter the length of the 3rd stick:\n'))

is_triangle(x, y, z)

triangle()

Add a comment
Know the answer?
Add Answer to:
need help with excercise 5.3 Exercise 5.3. If you are given three sticks, you may or...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Please Help. Thank you very much. 3. A firm producing hockey sticks has a production function...

    Please Help. Thank you very much. 3. A firm producing hockey sticks has a production function given by f(11, 12) = 21112 In the short run, the firm's amount of input two is fixed at Tz. 3.1 Calculate the firm's short-run total cost curve as a function of y, w1, W2, 72. 3.2 Suppose that I2 = 100, the price for input one is w1 = 4, and the price of input two is w2 = 1. Draw a graph...

  • PLEASE READ AND CODE IN BASIC C++ CODE. ALSO, PLEASE CODE USING THIS DO WHILE LOOP...

    PLEASE READ AND CODE IN BASIC C++ CODE. ALSO, PLEASE CODE USING THIS DO WHILE LOOP AND FORMAT: #include <iostream> using namespace std; int main() { //variables here    do { // program here             }while (true);    } Objectives To learn to code, compile and run a program containing SELECTION structures Assignment Write an interactive C++.program to have a user input the length of three sides of a triangle. Allow the user to enter the sides...

  • Must be java code Project 2b: CalculatePerimeter You are to write code for the application CalculatePerimeter where the computer calculates and displays the perimeter of a triangle, provided the three...

    Must be java code Project 2b: CalculatePerimeter You are to write code for the application CalculatePerimeter where the computer calculates and displays the perimeter of a triangle, provided the three double values entered from keyboard input represent a triangle. If they don't, the computer should display the fact that (at least, in the case of non-positive input) one of the values does not form a valid triangle What makes a valid triangle? All sides must be positive and the sum...

  • Problem: Pick Up Sticks For this assignment you will be creating an interface for two humans...

    Problem: Pick Up Sticks For this assignment you will be creating an interface for two humans to play a simple game of "Pick Up Sticks". Here's how the game is played in the "real world": The game begins with a number of sticks on a table (between 10 and 100) Each player, in turn, takes between 1-3 sticks off the table. The player to take the last stick loses. Your job is to build a virtual version of the game...

  • Learn the example C program in Folio consisting of three files (a.c, a.h, main.c) and complete this exercise. You need t...

    Learn the example C program in Folio consisting of three files (a.c, a.h, main.c) and complete this exercise. You need to understand function, pointer and the selection sort algorithm. Write a C program that consists of three files mysort.h, mysort.c and myMain.c. Below is the mysort.h prototype #include <stdlib.h> #include <stdio.h> void generateNums(int *myarr, int len); void sortNums(int *myarr, int len); mysort.h must contain only the function declarations (prototypes) listed above generateNums function should generate len random integers in the...

  • PID Control: This question will revisit the PID controller we discussed in class, and review the effects of the three gains. Given the open-loop transfer function G(s)3 5.2 Are you able to stabilize...

    PID Control: This question will revisit the PID controller we discussed in class, and review the effects of the three gains. Given the open-loop transfer function G(s)3 5.2 Are you able to stabilize the closed-loop system with a P control? If so, what is the 5.3 Are you able to stabilize the close-loop system with a PI controller? If so, what are the 5.1 Write down the open-loop poles and comment on the open-loop stability requirement of the P gain?...

  • A triangle is expressed by tuples of three positive numbers, which are the length of sides...

    A triangle is expressed by tuples of three positive numbers, which are the length of sides of the triangle. Two triangles a1 and a2 are similar if a2 can be generated by rotating and reflecting triangle a1. For example, t1 = (7, 10, 13) is similar to t2 = (7, 13, 10) since a2 can be obtained by rotating and reflecting t1. (7, 10, 13) rotate −−−→ (10, 13, 7) reflect −−−−→ (7, 13, 10) On the other hand, t1...

  • In java: A fun language: f you recently ate at Chipotle, you may have received a...

    In java: A fun language: f you recently ate at Chipotle, you may have received a brown paper bag with gibberish letters written on it: “AKINGMAY AWAY IGPAY EALDAY ABOUTWAY IGPAY ATINLAY”. In fact this message is written in Piglatin, a simple but fictitious language. Piglatin converts a word in English using the following two rules: If the letter begins with a vowel, then “WAY” is appended to the word. If the letter begins with a consonant (a letter other...

  • i need help with these 3 homework problems, thank you ! Solve a Triangle Using the...

    i need help with these 3 homework problems, thank you ! Solve a Triangle Using the Law of Sincs (SSA) Ambiguous Case Suppose that the measure of angle A and the lengths of sides a and b of a triangle are given. Depending on the length of side a (shown in red) relative to the length of the altitude h, we have four different scenarios No triangle One right triangle One oblique triangle Two triangles: One acute and one obtuse...

  • Need help with Java for Fraction exercise

    Add another public method called add to your Fraction class. This method adds another fraction to the ‘calling object’. Thus, the method will take a Fraction class object as a parameter, add this parameter fraction to the calling object (fraction), and return a Fraction object as a result. HINT: We can use cross multiplication to determine the numerator of the resultant Fraction. The denominator of the resultant Fraction is simply the multiplication of the denominators of the two other Fractions.Add...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT