vendredi 14 décembre 2018

Python - Assign value based on condition

I have a variable that stores email address. Based on the email address assigned to this variable I would like to assign a new email address to another variable.

Given below is some info on this.

var1 <- Variable can have one of the two values as mentioned below:


 1. apple@mail.com
 2. tomato@mail.com

I am trying to create a new variable called var2 which will have fruit@mail.com if var1 = apple@mail.com or have veg@mail.com if var1 = tomato@mail.com

Aucun commentaire:

Enregistrer un commentaire