Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Regular Expressions in Python Introduction to Regular Expressions Groups

Logesh Jayaraman
Logesh Jayaraman
445 Points

Mixed Data

In the sample data used the data is on a specific flow. For example it starts Name,email ,phone number,job,company,twitter,Name,email ,phone number,job,company,twitter, Name,email ,phone number,job,company,twitter

what if the data is mixed the row has the order of Name,email ,phone number,job,company,twitter and the next row or person data is email ,phone number,job,company,twitter, Name

1 Answer

Ryan Ruscett
Ryan Ruscett
23,309 Points

Hey,

If I have a method like this.

def Contact(Name,email ,phone number,job,company,twitter,Name,email ,phone number,job,company,twitter) :
               //DO SOME CODE

``

Now, when I pass information into that contact. The data is given in order. The first argument passed is is the Name, the second is email.

If I pass email first and Name second. That is ok. It will still work. But Name will hold the value of an email and email will hold the value of a name. 

Here is an example.

```python

>>> def contact(name, age, title):
...     identity = name
...     how_old = age
...     job = title
...     print(identity + " " + how_old + " " + job)
>>> contact("ryan", "29", "engineer")
ryan 29 engineer

See that looks right. It's also easy to read, because if I look at the method I know what name, age and title mean. It's simple. But if I mix them up.

>>> contact("engineer", "ryan", "29")
engineer ryan 29

See it still works but it no longer makes any sense.

Does this answer your question? Let me know if it does or does not and I can try to help further.

Thanks!