Basic Codes
Basic Codes
2. Using a function
def s a y h e l l o ( ) :
print ( ” H e l l o Python ” )
say hello ()
3. Using f-string
name = ” Python ”
print ( f ” H e l l o {name}” )
1
7. Using a class method
class Greeter :
def g r e e t ( s e l f ) :
print ( ” H e l l o Python ” )
g = Greeter ()
g . greet ()
f o r g r e e t i n g in h e l l o g e n ( ) :
print ( g r e e t i n g )