Facebook
From Tacky Earthworm, 4 Years ago, written in Python.
This paste is a reply to Assignment 3 from Favourjama - view diff
Embed
Download Paste or View Raw
Hits: 90
  1. # question 1 and 2
  2. def vowel_counter ():
  3.   user_input= input ("Enter Word")
  4.   number_of_vowels = 0
  5.   for i in user_input:
  6.     if i=="a" or i=="e" or i=="i" or i=="o" or i=="u":
  7.       number_of_vowels+=1
  8.   if number_of_vowels==1:
  9.     print (f " {user_input} contains {number_of_vowels} vowel")
  10.    
  11.   else:
  12.     print (f " {user_input} contains {number_of_vowels} vowels")
  13.    
  14. #question 3
  15. def maximum (arr):
  16.     highest =0
  17.     for i in arr:
  18.       if i>=highest:
  19.         highest=i
  20.       print (highest)
  21. maximum([1,2,44,98])
  22.      
  23. #question 4
  24. def summation (arr):
  25.   sum=0
  26.   for i in arr:
  27.     sum +=i
  28.   print (sum)
  29. summation ([1, 2, 3, 5])