Aug 9, 2024
app.py
.print('I am Mosh Hamedani')
print('o----') # Dog's head and body
print(' | |') # Legs
price = 10
print(price)
).input()
function:
name = input('What is your name? ')
print(f'Hi {name}')
try
and except
to handle errors:
try:
age = int(input('Enter your age: '))
except ValueError:
print('Invalid value')
def greet_user(name):
print(f'Hello {name}')
greet_user('Mosh')
class Point:
def __init__(self, x, y):
self.x = x
self.y = y
class Dog(Mammal):
def bark(self):
print('Woof')
Path
object from pathlib
for file system operations:
from pathlib import Path
my_file = Path('example.txt')