Skip to content

Instantly share code, notes, and snippets.

View lARSHADl's full-sized avatar
🖤
Seeker | Believer | Achiever

Arshad Ahmed lARSHADl

🖤
Seeker | Believer | Achiever
  • india
View GitHub Profile
# Write code that will count the number of vowels in the sentence s and assign the result to the variable num_vowels.
# For this problem, vowels are only a, e, i, o, and u. Hint: use the in operator with vowels.
s = "singing in the rain and playing in the rain are two entirely different situations but both can be fun"
vowels = ['a','e','i','o','u']
# Write your code here.
num_vowels = sum([1 for i in s if i in vowels])
print(num_vowels)
# 1. Below are a set of scores that students have received in the past semester.
# Write code to determine how many are 90 or above and assign that result to the value a_scores.
scores = "67 80 90 78 93 20 79 89 96 97 92 88 79 68 58 90 98 100 79 74 83 88 80 86 85 70 90 100"
scores_split = scores.split(" ")
a_scores = 0
for x in scores_split:
x = float(x)
if x >= 90:
a_scores += 1