Sep 3, 2024
print("Your Name")
input()
function to get user inputname = input("What is your name? ")
print(f"Hi {name}")
and
, or
, not
==
, !=
, >
, <
, >=
, <=
for
loops: Iterate over a sequencewhile
loops: Execute a block as long as a condition is truedef
keyworddef greet_user(name):
print(f"Hello, {name}")
class Dog:
def bark(self):
print("Woof!")
class Mammal:
def walk(self):
print("Walking...")
try
and except
blockswith open('file.txt', 'r') as file:
content = file.read()