Loops and Such
# Build Array and Display using While Loop
print('\n---Buld List and Display Using While----')
mylist=['scott',24,float(2.35)]
x=0
while x < 3:
print('Array Counter',x)
print(mylist[x])
x+=1
# Display using For (Each) Item in Loop
print('\n---Foreach Style Loop----')
for item in mylist:
print(item)
# Loop using pre-defined Range with Break print('\n---Loop using pre-defined Range with Break---')for i in range (1,4): print(i) break for j in range (1,4): print(j)
# Display Dictionary Key Values Pairs
print('\n---Display Dictionary Key Values Pairs ---')
for key, value in myobj.items():
print(key,value)
# Display Dictionary Items & Key Values
print('\n---Enumerate Display Dictionary Items & Key Values----')
for my_item in enumerate(myobj):
print(my_item)
# Loop using pre-defined Range
print('\n---Loop using pre-defined range---')
i=1
for i in range (1,10):
print(i)
i+=1
# Build Dictionary Array
print('\n--- Build Dictionary Array List to use the items() Method----')
print('---Differnence is {} in the used in list statment---')
myobj ={
'Computer Name':'Server01',
'OS':'Windows Server 2022'
}