Question

In: Computer Science

Given an int b, set the variable answer to equal "negative" if b is less than...

Given an int b, set the variable answer to equal "negative" if b is less than 0; set answer to "positive" if b is greater than 0; and set it to "zero" if b equals zero

in python

Solutions

Expert Solution

b = int(input("Enter an Integer: "));
if(b < 0):
   answer = "negative"
elif (b > 0):
   answer = "positive"
else:
   answer = "zero"

print("Answer Is: ", answer)


Related Solutions

prove that 2/pi is less than or equal to (sinx)/x which is less than or equal...
prove that 2/pi is less than or equal to (sinx)/x which is less than or equal to 1. for x is in (0,pi/2]
Recall P2(t) is the set of polynomials of order less than or equal to 2. Consider...
Recall P2(t) is the set of polynomials of order less than or equal to 2. Consider the the set of vectors in P2(t). B={t^2,(t−1)^2,(t+1)^2} (a) Show B is a basis for P2(t). (b) If E={1,t,t^2}is the standard basis, calculate the change of basis matrices PE→B and PB→E (c) Given v= 2t^2−5t+ 3, find its components in B
Let Z be a standard normal variable. calculate the following; P(Z less than or equal to...
Let Z be a standard normal variable. calculate the following; P(Z less than or equal to 1.29) = P(-0.76 < Z< 1.92)=
The density of a random variable X is given by f(x)=(3x^2, o less than x less...
The density of a random variable X is given by f(x)=(3x^2, o less than x less than 1, or f(x)=0, otherwise Let Y=e^x (a) find the density function of Y(b) find E(Y) two ways:(i)using the density of Y and (ii) using the density of X
For each of the following, fill in the blanks with "Less than", "Greater than", or "Equal...
For each of the following, fill in the blanks with "Less than", "Greater than", or "Equal to" *) A gas flows through a one-inlet, one-exit control volume operating at steady state with no internal irreversibilities, Qcv = 0. Heat transfer at a rate Qcv takes place only at a location on the boundary where the temperature is Tb. The specific entropy of the gas at the exit is _____ than the specific entropy of the gas at the inlet. *)...
PLEASE ANSWER IN C Assume that an int variable age has been declared and already given...
PLEASE ANSWER IN C Assume that an int variable age has been declared and already given a value and assume that a char variable choice has been declared as well. Assume further that the user has just been presented with the following menu: S: hangar steak, red potatoes, asparagus T: whole trout, long rice, brussel sprouts B: cheddar cheeseburger, steak fries, cole slaw (Yes, this menu really IS a menu!) Write some code that reads a single character (S or...
Test of equal or given proportions: Use the “bacteria” data set to answer the question, “did...
Test of equal or given proportions: Use the “bacteria” data set to answer the question, “did the drug treatment have a significant effect of the presence of the bacteria compared with the placebo?” Please use R to answer this question. It should be use In R studio. dataset is also in the R
Test of equal or given proportions: Use the “bacteria” data set to answer the question, “did...
Test of equal or given proportions: Use the “bacteria” data set to answer the question, “did the drug treatment have a significant effect of the presence of the bacteria compared with the placebo?” Please use R to answer this question. It should be use In R studio. dataset is also in the R. it's large to put here. Just open R studio, view(bacteria).
If we are testing the null hypothesis that the mean is less than or equal to...
If we are testing the null hypothesis that the mean is less than or equal to 100, and the critical value for the test is determined to be z = 1. 645, then the rejection region would be all of the z values that are ____________ 1. 645. Multiple Choice greater than less than greater than or equal to less than -1.645 or greater than +1.645
I. Answer part A, B, and C 1a) Return true if the given int parameter is...
I. Answer part A, B, and C 1a) Return true if the given int parameter is both positive and less than 10, and false otherwise. Remember that 0 is not positive! positiveLessThan10(10) → false positiveLessThan10(9) → true positiveLessThan10(11) → false 1b) Return true if the parameters are in ascending order, from left to right. Two values that are equal are considered to be in ascending order. Remember, you can just type return true or return false to return true or...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT