Print the number of characters in the following paragraph:
Python is an easy to learn, powerful
programming language. It has efficient high-level data structures and
a simple but effective approach to object-oriented
programming. Python’s elegant syntax and dynamic typing, together with
its interpreted nature, make it an ideal language for scripting and
rapid application development in many areas on most platforms.
I prefilled the answer box with the paragraph as a Python string, and
assigned it the name whetting_your_appetite
.
You'll need the
len
function, which can measure almost anything: lists, strings, …
If you feel lost, you should start by reading the string tutorial.
You don't have to edit line 1-5, write your code below the # Enter your code below:
comment and don't forget to use the print
function to print the result!
A function is a named thing, that take a value (or multiple ones), do something with it, and often give back another value.
A basic example would be the max
function that take multiple values
and give back the biggest one, the syntax is:
max(1, 5, 2)
and it would give back 5
.
What's given back by a function can be used:
Typically if you want to print the 5
from the previous example, you
can either do:
biggest_one = max(1, 5, 2)
print(biggest_one)
or:
print(max(1, 5, 2))
There's no corrections yet, hit the `Submit` button to send your code to the correction bot.
Keyboard shortcuts: