Substitution without creating a new variable in python [closed] - python-3.x

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 days ago.
Improve this question
a = 5
b = 3
How to substitution without creating a new variable in python and JS Or other programming language.
The value of (a) should be replaced by (b), and the value of (b) by (a).
Tried but couldn't without creating a new variable.

you can use :
a , b = b , a
hope it was usefull theres other methos but this is the easiest

Related

Firebase Admin SDK - How to Get User's Last Name [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 months ago.
Improve this question
Is there a way to get user's last name so we can use it inside our welcome message? I tried this code, but it just gave me a complete name; not the last name. How do I get the user's last name? I have sought inside stackoverflow.com, but found nothing at all. Please help me solve this problem. Thank you.
const name = context.auth.token.name;

How to change specific part of a string? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
For example, I have a string like this
a = "starlight sunlight"
And I want to change it into
a = "starspot sunspot"
well i guessed you writing this in python so you can use the replace method
enter example
in your case you went to replace the word light with the word spot so just write
a=a.replace("light","post")

Ask the user for its name using raw_input [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
How do I write a program that uses raw_input to prompt a user for their name and then welcomes him.
For example that asks: Enter your name, and then the program continues welcoming the user with Hello NAME_OF_THE_USER
This is one of the easiest problem ever. This is my solution (since you tagged your post for Python 3):
name = input('Enter your name: ')
print("Welcome", name)
For Python 2, just change input to raw_input, and remove the parenthesis of the print function.

Python similar type of string to search [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I have just started learning python and I have a question. I have a text file which I opened. The file has random questions. Now my question is how can I search for any question similar to this type of question "what is your .... " and "how do you ...." and return the whole question . I am using python 3.x. Please help
I highly suggest you spend some time reading about regex. The trick would be to search for a string that includes the first words you want (the "What is your" statement) and ends with a question mark. The following docs should give you quite a bit of clarity.
https://docs.python.org/3.4/library/re.html
https://docs.python.org/3.4/howto/regex.html#regex-howto

Stacked IF AND Statement returns #Value error [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
I'm probably doing this wrong.. it returns a #Value error...
=IF(AND(B2=0,W2<>0),1,0),IF(AND(B2>0,W2=0),1,0)
IF only allows 3 arguments and you can't just join them outside each other with a ,.
=IF(OR(AND(B2=0,W2<>0),AND(B2>0,W2=0)),1,0)
Or if you only want 1 or 0 as the outputs then:
=--OR(AND(B2=0,W2<>0),AND(B2>0,W2=0))
The -- will turn TRUE/FALSE to 1/0 respectively.
As per #Jeeped's comment.

Resources