Archive of QA for this lesson


#1

Below please find links to archived Q&A discussion for the Practice Makes Perfect course.

Practice Makes Perfect

Exercise 1.1: Practice! Practice Practice!
Exercise 1.2: is_even
Exercise 1.3: is_int
Exercise 1.4: digit_sum
Exercise 1.5: factorial
Exercise 1.6: is_prime

Exercise 2.1: reverse
Exercise 2.2: anti_vowel
Exercise 2.3: scrabble_score
Exercise 2.4: censor

Exercise 3.1: count
Exercise 3.2: purify
Exercise 3.3: product
Exercise 3.4: remove_duplicates
Exercise 3.5: median


#3

why this isn't working?

def reverse(text):
text1=""
num=len(text)
for i in range(len(text),1):
text1= text1+text[i]
return text1

t="python!"
print reverse(t)


#4

I know this may be a basic question but I have a code that works but I don't know how to print out the results so that I can see it myself. Here's what I have:

text = raw_input("Write a sentence with no punctution: ")
word = raw_input("Enter a word you would like to censor out: ")

def censor(text,word):
new_text = []
chop_word = text.split()
for x in chop_word:
if x == word:
y = "*" * len(word)
new_text.append(y)
else:
new_text.append(x)
return ' '.join(new_text)


#5