Oct 7, 2024
Installing Python:
Installing Code Editor:
print("I am Mosh Hamedani")
price = 10
print(price) # Outputs: 10
name = input("What is your name? ")
print(f"Hi {name}")
if condition:
# do something
else:
# do something else
for i in range(5):
print(i)
def greet_user(name):
print(f"Hello, {name}")
greet_user("Mosh")
class Dog:
def bark(self):
print("Woof!")
class Animal:
def eat(self):
print("Eating")
class Dog(Animal):
def bark(self):
print("Woof!")
import math
print(math.sqrt(16)) # Outputs: 4.0
try:
age = int(input("Enter your age: "))
except ValueError:
print("Please enter a valid number.")
#
to add comments to code.