Include ocmments about nesting
This commit is contained in:
		
							parent
							
								
									36132e4888
								
							
						
					
					
						commit
						83c8665406
					
				| 
						 | 
					@ -2,6 +2,11 @@
 | 
				
			||||||
# Note: Python's match implementation was introduced in Python version 3.10
 | 
					# Note: Python's match implementation was introduced in Python version 3.10
 | 
				
			||||||
 | 
					
 | 
				
			||||||
num = None
 | 
					num = None
 | 
				
			||||||
 | 
					# Note that this has a nested structure. There is an outer while loop
 | 
				
			||||||
 | 
					# which contains an inner try/except block. Structures can be nested
 | 
				
			||||||
 | 
					# at nearly infinite complexity, but if the structure gets more than
 | 
				
			||||||
 | 
					# a short few nestings it gets confusing to read and functions
 | 
				
			||||||
 | 
					# (dicussed later) should probably be used at that point.
 | 
				
			||||||
while num is None:
 | 
					while num is None:
 | 
				
			||||||
    try:
 | 
					    try:
 | 
				
			||||||
        num = int(input("Enter a number between 1 and 3: "))
 | 
					        num = int(input("Enter a number between 1 and 3: "))
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user