python
A simple Python program
# This is a simple Python script
def greet(name):
return f”Hello, {name}! Welcome to Python.”
def add_numbers(a, b):
return a + b
if __name__ == “__main__”:
user_name = input(“Enter your name: “)
print(greet(user_name))
x = int(input(“Enter first number: “))
y = int(input(“Enter second number: “))
print(“Sum:”, add_numbers(x, y))
def greet(name):
return f”Hello, {name}! Welcome to Python.”
def add_numbers(a, b):
return a + b
if __name__ == “__main__”:
user_name = input(“Enter your name: “)
print(greet(user_name))
x = int(input(“Enter first number: “))
y = int(input(“Enter second number: “))
print(“Sum:”, add_numbers(x, y))
What this teaches you
- Functions (
greet,add_numbers) - User input (
input()) - Basic data types (strings, integers)
- Condition to run script (
if __name__ == "__main__":)
If you tell me what you actually want to do (automation, web apps, data analysis, games, etc.), I can tailor a much more useful piece of Python for you instead of just a generic example.
