Advertisement
Guest User

Untitled

a guest
Mar 3rd, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import re
  2.  
  3. offerte = []
  4. altre_offerte = True
  5.  
  6. while altre_offerte:
  7.     offerta = input("Inserisci l'offerta prevenuta(0 per terminare)")
  8.  
  9.     try:
  10.         offerta=float(offerta)
  11.     except ValueError:
  12.         print("Formato non valido")
  13.         continue
  14.  
  15.  
  16.     if offerta == 0:
  17.         altre_offerte = False
  18.         continue
  19.  
  20.     if offerta < 0:
  21.      print("non possono essere fatte offerte negative!")
  22.      continue
  23.  
  24.  
  25.     email = input("Inserisci l'email del offerente")
  26.  
  27.     if not (re.match("^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$", email)):
  28.         print("Email non valida, riprova..")
  29.         continue
  30.  
  31.   offerte.append([email, offerta])
  32.  
  33. print(offerte)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement