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...
Python: Provide code and result Given 4 values x, y, s, and t. Write a one-line...
Python: Provide code and result Given 4 values x, y, s, and t. Write a one-line command to check if x > y or s > t. If yes, the code should output "True" We try to define a function in Figure 2, please identify two problems with the code. Write an inline if statement to assign x the value 1 if the variable y = 'female' and assign x the value 0 if the variable y = 'male'. The...
1. What is the output of the following code fragment? (All variables are of type int.)...
1. What is the output of the following code fragment? (All variables are of type int.) limit = 8; cout << 'H'; for (loopCount = 10; loopCount <= limit; loopCount++) cout << 'E'; cout << "LP"); 2. What is the output of the following code fragment if the input value is 4? (Be careful here.) int num; int alpha = 10; cin >> num; switch (num) { case 3 : alpha++; case 4 : alpha = alpha + 2; case...
write a python program for a function that takes in an integer n and prints the...
write a python program for a function that takes in an integer n and prints the nth taylor approximation for the function f(x)=e^x at the point x=0 to x=1
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
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!
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...
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
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT