Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create swap.py #422

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

meghamsh253
Copy link

swapping two numbers
Two integer inputs are taken and swapped

swapping two numbers
Two integer inputs are taken and swapped
@meghamsh253
Copy link
Author

I have added basic swap programm in python,please look into it and merge it.
Please, add hackTober tag .

@CaioSommerOzorio
Copy link

Seems kind of useless when fist looking at it, but it can be a legitimate function to have in some applications.

Copy link

@CaioSommerOzorio CaioSommerOzorio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be called as a function:

def swap(p, q):
    temp_1 = p
    p = q
    q = p
    print ("The Value of P after swapping: ", p) 
    print ("The Value of Q after swapping: ", q)
# Usage 
p = int(input("Enter p: "))
q = int(input("Enter q: "))
swap(p, q)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants