Compare commits

...

1 Commits
main ... v3

Author SHA1 Message Date
FunctionsAPI
f519fb78df Automatic push from FunctionsAPI 2025-06-12 09:05:38 +00:00
4 changed files with 56 additions and 2 deletions

51
New File Normal file
View File

@ -0,0 +1,51 @@
# my_module.py
def greet(name):
"""This function greets the person passed in as a parameter."""
return f"Hello, {name}!"
def add(x, y):
"""This function returns the sum of two numbers."""
return x + y
def write_to_file(filename, content):
"""This function writes the given content to the specified file."""
with open(filename, "w") as f:
f.write(content)
def read_from_file(filename):
"""This function reads the content of the specified file and returns it."""
try:
with open(filename, "r") as f:
return f.read()
except FileNotFoundError:
return "File not found."
def main():
"""Main function that runs when the script is executed directly."""
name = "Alice"
print(greet(name))
num1 = 5
num2 = 3
print(f"The sum of {num1} and {num2} is: {add(num1, num2)}")
file_content = "This is some content written to a file."
write_to_file("example.txt", file_content)
print(f"Content written to file: {file_content}")
read_file_content = read_from_file("example.txt")
print(f"Content read from file: {read_file_content}")
read_file_content = read_from_file("nonexistent.txt")
print(f"Content read from file: {read_file_content}")
if __name__ == "__main__":
print("This script is being run directly.")
main()
else:
print("This script is being imported as a module.")

View File

@ -1,2 +1 @@
# 0e3ae225fd9046bdbc1c57c0ec6c27fe
# python hello-world

2
main.py Normal file
View File

@ -0,0 +1,2 @@
def main(request):
return "hello, world"

2
requirements.txt Normal file
View File

@ -0,0 +1,2 @@
functions-framework==1.4.3
markupsafe==2.0.1