<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 <a href="https
Step1:  2. Color probability
You're playing a game with a friend involving a bag of marbles. In the bag are ten marbles
Step2:  3. Write an if-elif-else chain that determines a person’s stage of life.
Set a value for the variable age, and then
Step3:  4. process_data
You have a two-dimensional list in the following format
Step4:  5. user_contacts
You're putting together contact information for all the users of your website to ship them a small gift. You queried your database and got back a list of users, where each user is another list with up to two items
<ASSISTANT_TASK:>
Python Code:
# your code here
current_users = ["lira", "sarah", "james", "nicole", "AJ"]
new_users = ["lira", "sarah", "li", "chidi", "olympia"]
for i in current_users:
  if i in new_users:
    print("You need to enter a new username")
  else:
    print("This username is available")
Explanation: <a href="https://colab.research.google.com/github/gaargly/gaargly.github.io/blob/master/2021_06_16_Lira_Second_Assignment.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
Second Assignment
1. Do the following to create a program that simulates how websites ensure that everyone has a unique username.
􏰀* Make a list of five or more usernames called current_users.
􏰀* Make another list of five usernames called new_users. Make sure one or
two of the new usernames are also in the current_users list.
􏰀* Loop through the new_users list to see if each new username has already been used. If it has, print a message that the person will need to enter a new username. If a username has not been used, print a message saying that the username is available.
􏰀* Make sure your comparison is case insensitive. If 'John' has been used, 'JOHN' should not be accepted.
End of explanation
# your code here
def color_probability(texture, color):
  if texture == "smooth":
    if color in ("red","yellow","green"):
      return "0.33"
    else:
      return 0
  elif texture == "bumpy":
    if color == "red":
      return "0.66"
    elif color == "yellow":
      return "0.33"
    else:
      return 0
color_probability("bumpy","red")
Explanation: 2. Color probability
You're playing a game with a friend involving a bag of marbles. In the bag are ten marbles:
1 smooth red marble
4 bumpy red marbles
2 bumpy yellow marbles
1 smooth yellow marble
1 bumpy green marble
1 smooth green marble
You can see that the probability of picking a smooth red marble from the bag is 1 / 10 or 0.10 and the probability of picking a bumpy yellow marble is 2 / 10 or 0.20.
The game works like this: your friend puts her hand in the bag, chooses a marble (without looking at it) and tells you whether it's bumpy or smooth. Then you have to guess which color it is before she pulls it out and reveals whether you're correct or not.
You know that the information about whether the marble is bumpy or smooth changes the probability of what color it is, and you want some help with your guesses.
Write a function color_probability that takes two arguments: a color ('red', 'yellow', or 'green') and a texture ('bumpy' or 'smooth') and returns the probability of drawing that combination as a decimal fraction accurate to two places.
The probability should be a string and should discard any digits after the 100ths place. For example, 2 / 3 or 0.6666666666666666 would become the string '0.66'. Note this is different from rounding.
As a complete example, color_probability('red', 'bumpy') should return the string '0.57'.
End of explanation
# your code here
age = 65
if age < 2:
  print("This person is a baby")
elif (age >= 2 and age < 4):
  print("This person is a toddler")
elif (age >= 4 and age < 13):
  print("This person is a kid")
elif (age >= 13 and age < 20):
  print("This person is a teenager")
elif (age >= 20 and age < 65):
  print("This person is an adult")
elif (age >= 65):
  print("This person is an elder")
Explanation: 3. Write an if-elif-else chain that determines a person’s stage of life.
Set a value for the variable age, and then:
􏰀* If the person is less than 2 years old, print a message that the person is a baby.
*􏰀 If the person is at least 2 years old but less than 4, print a message that the person is a toddler.
*􏰀 If the person is at least 4 years old but less than 13, print a message that the person is a kid.
*􏰀 If the person is at least 13 years old but less than 20, print a message that the person is a teenager.
*􏰀 If the person is at least 20 years old but less than 65, print a message that the person is an adult.
*􏰀 If the person is age 65 or older, print a message that the person is an elder.
End of explanation
# your code here
nums = [[2, 5], [3, 4], [8, 7]]
def process_data(data):
  hold = 1
  for i in data:
    hold *= i[0]-i[1]
  return hold
process_data(nums)
Explanation: 4. process_data
You have a two-dimensional list in the following format:
data = [[2, 5], [3, 4], [8, 7]]
Each sub-list contains two items, and each item in the sub-lists is an integer.
Write a function process_data that processes each sub-list like so:
End of explanation
# your code here
people = [["Grae Drake", 98110], ["Bethany Kok"], ["Alex Nussbacher", 94101], ["Darrell Silver", 11201]]
def user_contacts(data):
  users = {}
  for i in people:
    if len(i) == 2:
      users[i[0]] = i[1]
    else:
      users[i[0]] = "None"
  return users
user_contacts(people)
Explanation: 5. user_contacts
You're putting together contact information for all the users of your website to ship them a small gift. You queried your database and got back a list of users, where each user is another list with up to two items: a string representing the user's name and their shipping zip code. Example data might look like:
[["Grae Drake", 98110], ["Bethany Kok"], ["Alex Nussbacher", 94101], ["Darrell Silver", 11201]]
Notice that one of the users above has a name but doesn't have a zip code.
Write a function user_contacts that takes a two-dimensional list like the one above and returns a dictionary with an item for each user where the key is the user's name and the value is the user's zip code. If your data doesn't include a zip code then the value should be None.
For example, using the input above, user_contacts would return this dictionary:
End of explanation
<END_TASK>