mirror of
				https://github.com/krahets/hello-algo.git
				synced 2025-11-01 03:24:24 +08:00 
			
		
		
		
	 1c0f350ad6
			
		
	
	1c0f350ad6
	
	
	
		
			
			* Add the intial translation of code of all the languages * test * revert * Remove * Add Python and Java code for EN version
		
			
				
	
	
		
			21 lines
		
	
	
		
			506 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			21 lines
		
	
	
		
			506 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| # File: vertex.py
 | |
| # Created Time: 2023-02-23
 | |
| # Author: krahets (krahets@163.com)
 | |
| 
 | |
| 
 | |
| class Vertex:
 | |
|     """Vertex class"""
 | |
| 
 | |
|     def __init__(self, val: int):
 | |
|         self.val = val
 | |
| 
 | |
| 
 | |
| def vals_to_vets(vals: list[int]) -> list["Vertex"]:
 | |
|     """Input a list of values vals, return a list of vertices vets"""
 | |
|     return [Vertex(val) for val in vals]
 | |
| 
 | |
| 
 | |
| def vets_to_vals(vets: list["Vertex"]) -> list[int]:
 | |
|     """Input a list of vertices vets, return a list of values vals"""
 | |
|     return [vet.val for vet in vets]
 |