Create 2 - Exact Postage.py
This commit is contained in:
		
							parent
							
								
									bd6f74196d
								
							
						
					
					
						commit
						076c70e72e
					
				
							
								
								
									
										12
									
								
								14/2 - Exact Postage.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								14/2 - Exact Postage.py
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,12 @@
 | 
				
			|||||||
 | 
					def postalValidate(S):
 | 
				
			||||||
 | 
					   S = S.replace(" ", "")
 | 
				
			||||||
 | 
					   if len(S) != 6:
 | 
				
			||||||
 | 
					      return False
 | 
				
			||||||
 | 
					   for i in range (6):
 | 
				
			||||||
 | 
					      if i%2:
 | 
				
			||||||
 | 
					         if not S[i].isdigit():
 | 
				
			||||||
 | 
					            return False
 | 
				
			||||||
 | 
					      else:
 | 
				
			||||||
 | 
					         if not S[i].isalpha():
 | 
				
			||||||
 | 
					            return False
 | 
				
			||||||
 | 
					   return S.upper()
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user