python class to string
def __str__(self):
return "foo"
python class to string
def __str__(self):
return "foo"
string representation of object python
#!/bin/python3
import math
import os
import random
import re
import sys
class Car:
def _init_(self,speed,unit):
self.speed=speed
self.unit=unit
def __str__(self):
return "Car with the maximum speed of {} {}".format(self.speed,self.unit)
class Boat:
def _init_(self,speed):
self.speed=speed
def __str__(self):
return "Boat with the maximum speed of {} knots".format(self.speed)
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us