Continuing the discussion from Why is it asking me to do it in .len but you don't even use the '.' to begin with:

On line 4, use .len() to print the length of my_string. how do you do this :sob::sob::sob:[quote=“worldhero, post:1, topic:287547, full:true”]
Please leave the following link in the post so we can find the unit module, else replace it with a link to the exact lesson:

Strings and Console Output![2018-02-15%20(1)|690x388]


please include your code and the error message


what code are you talking about I’m new to this so if you could help me out that would be great


you must have written code? Please copy paste it to the forum so i can see where you go wrong with len()


Perfect! By adding a class constructor and creating instance variables, we will soon be able to use the Dog class. However, the class constructor Dog is still empty. Let’s modify this by adding parameters to the Dog constructor.
You can think of parameters like options at an ice cream store. You can choose to order a traditional ice cream cone, but other times you may want to specify the size of the cone or the flavor of the ice cream.
For the Dog class, we can specify the initial dog age by adding parameters to the class constructor.
Parameters allow data types to be created with specified attributes.
Let’s add parameters to our Car class constructor:

class Car {

    //Use instance variables to model our Car class after a real-life car
    int modelYear;

    public Car(int year) {

        modelYear = year;

In the example above, we add the int parameter year to the Car constructor.
The value of modelYear will equal the int value that is specified when we first use this class constructor.

Add an int parameter called dogsAge in between the parentheses of the Dog() constructor.

Inside of the constructor block, set the instance variable age equal to the dogsAge parameter


Why is this on the python category of the forum? That is Java code

What exactly is your question? I don’t see a question.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.