LynxLee LynxLee - 2 months ago 16
Python Question

PySchools - Topic 1 Question 7

I was running through some practices for Python on and got stuck here. I'm sure it's a simple task. Anyone?

You can make use of the len(x) function to find out the number of characters in a string.


>>> greetings = "Hello World"
>>> len(greetings) # get the length of string
>>> greetings[0] # get the 1st character

Question here below:

greeting = "Hello Google!"
# number of characters stored in the variable greeting
number_of_char = len(greeting)

# repeat the greetings based on the number of character in 'greeting'
greetings =


You can multiply a string by an integer in order to repeat the string multiple times.

>>> 'abc' * 2