Question

in Python Write a code fragment that prints true if the double variables x and y...

in Python Write a code fragment that prints true if the double variables x and y are both strictly between 0 and 1and false otherwise.

Homework Answers

Answer #1

Answer

Here is your answer for above probelm, if you have any doubt please comment, i am here to help you.

here is python script for above problem.

sample.py

x=0.0001  #you can give your own value to test the condition.
y=0.001
#here is the condition described in problem, we can use and operator to perform this.
#here the x and y value should in between 0 and 1, then it will be true, else false
if x>0 and x<1 and y>0 and y<1:
     print("true")
else:
     print("false")

output

any doubt ,please comment.,

Thanks in advance

Know the answer?
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
Similar Questions
Write an assignment statement that swaps the values of  variables X and Y. code in python
Write an assignment statement that swaps the values of  variables X and Y. code in python
Write a Python program using that takes a number as input and then prints if the...
Write a Python program using that takes a number as input and then prints if the number is even or odd. The program should use a function isEven that takes a number as a parameter and returns a logical value true if the number is even, false otherwise.
How to code this in python Write a program that computes and prints the first 1000...
How to code this in python Write a program that computes and prints the first 1000 prime numbers - simply write out each prime number on a new line. In implementing this solution I want you to define 2 functions: is_prime which can be used to test whether a number is a prime (e.g. is_prime(17) returns True but is_prime(9) returns False) and compute_primes which will return an array (or Python list) of the first n primes where n is passed...
please write a LONG basic piece of code in Python language that focuses on using Variables,...
please write a LONG basic piece of code in Python language that focuses on using Variables, please do not make the code short! thank you!
1. a) a Write x + y as a sum-of-products in the variables x and y....
1. a) a Write x + y as a sum-of-products in the variables x and y. b) Write x(y + 1) as a sum-of-products in the variables x and y. c) Write (x + y)(x + y) as a sum-of-products in the variables x and y. d) Write 1 as a sum-of-products in the variables x and y. 2. Verify both distributive Laws using Truth Table
this is in python 3.6 Write a program that prints to three significant figures the values...
this is in python 3.6 Write a program that prints to three significant figures the values of x and g(x) from x = 0 to x = 10 in increments of 2 units. The values of x include 0 and 10. The function g(x) is defined below: g(x): sqrt(x); x<4    sqrt(4); 4<=x The output of the first and last values are below: 0.000 0.000 ... ... 10.000 2.000
IV.Translate the following C code fragment to ARM assembly instructions. Assume t, x, y, and z...
IV.Translate the following C code fragment to ARM assembly instructions. Assume t, x, y, and z are stored in registers r0, r1, r2, and r3. unsigned int x, y, z, t; do { x = x + 1; z = t + (z << 1); y = y - x; } while (y != x); V. What does the following sequence of instructions do? Why? RSB r2, r3, r3, LSL #4 RSB r2, r2, r2, LSL #3 VI. Write a...
PLEASE HURRY, will upvote if correct python Write a method that prints characters using the following...
PLEASE HURRY, will upvote if correct python Write a method that prints characters using the following header: def printChars(ch1,ch2): this function prints out the characters between ch1 and ch2 inclusive. Assumption is that ch2 is always bigger than c1 and both lower cases. also Write a function that accepts a list as an argument and prints the number of occurrence of each item def itemOccurence(myList): i.e. input ("Hello",123, 342, 123, "Hello",123) output: 2 times "Hello" 3 times 123 1 time...
Q(x,y) is a propositional function and the domain for the variables x & y is: {1,2,3}....
Q(x,y) is a propositional function and the domain for the variables x & y is: {1,2,3}. Assume Q(1,3), Q(2,1), Q(2,2), Q(2,3), Q(3,1), Q(3,2) are true, and Q(x,y) is false otherwise. Find which statements are true. 1. ∀yƎx(Q(x,y)->Q(y,x)) 2. ¬(ƎxƎy(Q(x,y)/\¬Q(y,x))) 3. ∀yƎx(Q(x,y) /\ y>=x)
Write a python code that calculates the mean and median of a sample of 100 uniform...
Write a python code that calculates the mean and median of a sample of 100 uniform random numbers between 0 and 2 and the percentage of points in the sample that are greater than 1.
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT