#1 create a function that takes a string and returns the number (count) of vowels contained within it.
def count_vowels(text):
  output = 0
  for letter in text:
    if letter in "aeiou":
      output += 1
  print(output)

#count_vowels("python")




#2 create a function that takes a list of strings and integers, and filters out the list so that it returns a list of integers only.
def filter_list(arr):
  output = []
  if type(arr) is list:
    for item in arr: 
      if type(item) is int:
        output.append(item)
  print(output)

#filter_list(["lorem", 1 , 9, "17", "a"])




#3 a set is a collection of unique items. a set can be formed from a list from removing all duplicate items.
def setify(arr):
  output = []
  if type(arr) is list:
    output = set(arr)
    output = list(output)
  print(output)

#setify([1, 3, 3, 5, 5])




#4 create a function that takes a string and returns a string in which each character is repeated once.
def double_char(text):
  output = ""
  output_arr = []
  repeat_time = 2
  if type(text) is str:
    text_arr = list(text)
    for letter in text_arr: 
      i = 0
      while i < repeat_time:
        output_arr.append(letter)
        i += 1
  output = "".join(output_arr)
  print(output)

#double_char("hello world!")




#5 write a function that finds the sum of the first n natural numbers. Make your function recursive.
def sum_numbers(num):
  i = 1
  output = 0
  while(i <= num):
    output +=i
    i += 1
  print(output)

#sum_numbers(12)




# write a function that takes a list and a number as arguments.add the number to the end of the list, then remove the first element of the list. The function should then return the updated list.
def next_in_line(arr, num):
  if len(arr) < 1:
    print("No list has been selected")
    return
  arr.pop(0)
  arr.append(num)
  print(arr)
  
#next_in_line([], 10)