DEV Community 👩‍💻👨‍💻

Discussion on: Daily Challenge #223 - Responsible Drinking

Collapse
 
arnavmotwani profile image
Arnav Motwani

My solution in python

import re
order = input("list the drinks")


def Hydrate(order):
    glasses = 0
    drinks = re.split(", |and ",order)
    for number in drinks:
        tab = number.split(" ")
        glasses += int(tab[0])
    print(glasses)

Hydrate(order)