Home
Recent Q&A
Java
Cloud
JavaScript
Python
SQL
PHP
HTML
C++
Data Science
DBMS
Devops
Hadoop
Machine Learning
Azure
Blockchain
Devops
Ask a Question
In-place swapping of two numbers in python
Home
Python
In-place swapping of two numbers in python
0
votes
asked
May 24, 2020
in
Python
by
SakshiSharma
In-place swapping of two numbers
#python-programs
#python-swap-number-program
#program-swap-numbers
Python-questions-answers
Please
log in
or
register
to answer this question.
1
Answer
0
votes
answered
May 24, 2020
by
Robindeniel
p, q = 20, 40
print(p, q)
p, q = q, p
print(p, q)
Output:
20 40
40 20
Your comment on this answer:
Email me at this address if a comment is added after mine:
Email me if a comment is added after mine
Privacy: Your email address will only be used for sending these notifications.
Related questions
0
votes
Q: Write code to show randomizing the items of a list in place in Python along with the output.
asked
Oct 14, 2021
in
Python
by
rajeshsharma
randomizing-number
Python-questions-answers
0
votes
Q: Explain how can you generate random numbers in Python?
asked
Jan 1, 2021
in
Python
by
SakshiSharma
#python-random-number-generation
Python-questions-answers
0
votes
Q: The two main versions of Python include ___________.
asked
Jun 24, 2020
in
Python
by
Robindeniel
#python-versions
#version-python
Python-questions-answers
0
votes
Q: Checking whether the two words are anagrams or not in python
asked
May 24, 2020
in
Python
by
SakshiSharma
#python-anagrams
#anagram-python
Python-questions-answers
+1
vote
Q: If you have two sets like this -> s1 = {1,2,3,4,5,6}, s2 = {5,6,7,8,9}. How would you find the common elements in these sets.
asked
Feb 15, 2021
in
Python
by
SakshiSharma
#python-dataset
dataset
python
Python-questions-answers
+1
vote
Q: How to select columns in pandas and add them to a new dataframe? What if there are two columns with the same name?
asked
Feb 14, 2021
in
Python
by
SakshiSharma
#python-columns
python-dataframe
dataframes
python
Python-questions-answers
0
votes
Q: How can you concatenate two tuples?
asked
Feb 10, 2021
in
Python
by
SakshiSharma
#concatenate-tuples
tuples
concatenate
python
Python-questions-answers
0
votes
Q: Which of the following method is used to check equality of two lists in a test, with unitest?
asked
Jun 30, 2020
in
Python
by
GeorgeBell
#python
Python-questions-answers
0
votes
Q: What are the two major loop statements?
asked
May 16, 2020
in
Python
by
Robindeniel
#python-loops
#python-statements
Python-questions-answers
+1
vote
Q: In order to store values in terms of key and value we use that core data type in python?
asked
Jan 30, 2022
in
Python
by
sharadyadav1986
python-data-types
Python-questions-answers
...