我正试图解决这个问题,如何在句子中表达辅音.我刚刚使用的代码似乎没有完成这项工作:
vowels = ("aeiou")
count = 0
for x in text:
if not x in vowels:
count += 1
Run Code Online (Sandbox Code Playgroud)
在示例"hello world"中作为输入,我收到8个辅音.提前谢谢了.
码:
def Division():
print "************************\n""********DIVISION********\n""************************"
counter = 0
import random
x = random.randint(1,10)
y = random.randint(1,10)
answer = x/y
print "What will be the result of " + str(x) + '/' + str(y) + " ?"
print "\n"
userAnswer = input ("Enter result: ")
if userAnswer == answer:
print ("Well done!")
print "\n"
userInput = raw_input ("Do you want to continue? \n Enter 'y' for yes or 'n' for no.")
if userInput == "y":
print "\n"
Division()
else:
print "\n" …Run Code Online (Sandbox Code Playgroud) python ×2