Make it equal in Python

Make it equal in Python assignment expert

In this blog post, we will see how to make it equal in Python means how to compare and make 2 variables equal to each other.

Code to make it equal in Python

# declare a variable
x = 5  # you can take input from user too

# declare another variable
y = 7  # you can take input from user too

# checking/comparing which one is big
if x>y:
    print("x is greater than y, to make y equal to x, add ", x - y, " to y")
elif x == y:
    print("x is equal than y, you need to do nothing")
else:
    print("y is greater than x, to make x equal to y, add ", y - x, " to x")

Output:

Make it equal in Python

Explanation:

We have declared two articles and then compared them to print the difference that can make both variables equal. We hope this short blog may help you. If you need to ask any questions, let us know in the comments.

Thank you for visiting our website.


Also Read:

Share:

Author: Harry

Hello friends, thanks for visiting my website. I am a Python programmer. I, with some other members, write blogs on this website based on Python and Programming. We are still in the growing phase that's why the website design is not so good and there are many other things that need to be corrected in this website but I hope all these things will happen someday. But, till then we will not stop ourselves from uploading more amazing articles. If you want to join us or have any queries, you can mail me at admin@violet-cat-415996.hostingersite.com Thank you