<jupyter_start><jupyter_text>While Loop<jupyter_code># Exercise 1
squares = ['orange', 'orange', 'purple', 'orange', 'blue']
new_squares = []
i = 0

while(squares[i] == 'orange'):
  new_squares.append(squares[i])
  i = i + 1

print(new_squares)
# Exercise 2
# Usage of while loop and break keyword
num_sum = 0
count = 0 

while(count < 10):
  num_sum = num_sum + count
  count = count + 1
  print(count)

  if count == 7:
    print('the condition is about to be broken')
    break

print('Sum of first', count, 'integers is: ', num_sum)
# Exercise 3
# Usage of continue keyword
for x in range(7):
  if(x == 3 or x == 6):
    continue
  print(x)<jupyter_output>0
1
2
4
5<jupyter_text>For Loop<jupyter_code># range( )

for a in range(9):
  print(a)

print()

for a in range(4, 7):
  print(a)
print()

for a in range(5, 30 ,5):
  print(a)
# Exercise 1 - Using for x in range() and for x in datas
numbers = []
for a in range(1, 10):
  numbers.append(a)

print('Numbers are: ', numbers)
count_odd, count_even = 0, 0
for x in numbers:
  if x % 2:
    count_odd += 1
  else:
    count_even += 1

print("Number of even numbers :", count_even)
print("Number of odd numbers :", count_odd)

# Exercise 2  - Using for x in datas
datalist = [1452, 11,23, 1+2j, True, 'w3resource', (0, -1), [5, 12],
            {"class": 'V', "section" : 'A'}]

for item in datalist:
  print("Type of", item, "is", type(item))
# Exercise 3 - Using for x in datas
color = {"c1" : "Red", "c2" : "Green", "c3" : "Orange"}
for key in color:
  print(key)

print()
for value in color.values():
  print(value)
# Exercise 4 - Using for x, data in enumerate
squres = ['red', 'yellow', 'green']
for i, square in enumerate(squares):
  print('square: ', square)
  print('index: ', i)
  print()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.15833801235261089, 'fraction_numerical': 0.032004491858506456, 'mean_word_length': 3.777479892761394, 'pattern_counts': {'":': 1, '<': 9, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '564187', 'license': 'MIT', 'n_tokens_mistral': 749, 'n_tokens_neox': 679, 'n_words': 228, 'path': 'coding-exercises-avairds/week4/part1-additional-lectures-loops/loops.ipynb', 'repo_name': 'Alex-Snow-School-Lab/Python-Basics', 'size': '1781'}