Home > other > [for] learning Python programming from entry to practice, to inherit this chapter to add 'origi
[for] learning Python programming from entry to practice, to inherit this chapter to add 'origi
Time:11-29
The HTML code is as follows, in vs. code and jupyter tried not The class Car () : Def __init__ (self, the make, model, year) : Self. Make=make The self. The model=model The self. The year=year Self. Odometer_reading=10
Def get_descriptive_name (self) : Long_name=STR (self. Year) + "+ self. Make +" + self. The model Return long_name Def read_odometer (self) : Print (' This car from the '+ STR (self. Odometer_reading) + "miles on it.") Def update_odometer (self, mileage) : If the mileage & gt;=self. Odometer_reading: Self. Odometer_reading=mileage The else: Print (" You can 't roll back an odometer!" ) Def increment_odometer (self, miles) : If the miles & gt;=0: Self. Odometer_reading +=miles The else: Print (" You can 't roll back an odometer!" )
The class '() : Def __init__ (self, battery_size=70) : "" "" "" initialize battery properties Self. Battery_size=battery_size Def describe_battery (self) : Print (" This car has a "+ STR (self. Battery_size) +" - KWH '. "
The class ElectricCar (Car) : Def __init__ (self, the make, model, year) : Super () __init__ (make, model, year) Self. '=' ()
My_tesla=ElectricCar (' tesla ', 'the model s' 2016) Print (my_tesla. Get_descriptive_name ()) My_tesla. '. Describe_battery ()
Prompt error below
Thank you for your help! By the way, could you tell me why there is no Python CSDN BBS big plate...
CodePudding user response:
As the indentation in the BBS have a problem, everyone please ignore...
CodePudding user response:
Why hasn't the CSDN BBS Python's big plate Because: Even though the CSDN is domestic technical BBS do relatively well, but the experience is very general, And Python in previous years is not popular, so there is no separate separate plate, and is placed in the Other Perl tied for the scripting language of
As the indentation in the BBS have a problem, everyone please ignore... Bother you to release the code, in the form of code in the BBS
Specific how to operate, screenshots, for example:
1. Select your code
2. Format of choice for code - & gt; Python
3. Switch to the preview, you can see is the Python code
Format so that you can keep the original code, including indentation, code won't messed up, and showed up with color, highlighting, the code easier to read, other people also easy to copy out the complete code, help you to test and find problem,