MCPcopy Create free account
hub / github.com/geekcomputers/Python / main

Function main

new_pattern.py:1–15  ·  view source on GitHub ↗

Main function that gets user input and calls the pattern generation function.

()

Source from the content-addressed store, hash-verified

1def main():
2 """Main function that gets user input and calls the pattern generation function."""
3 try:
4 lines = int(input("Enter number of lines: "))
5 if lines < 0:
6 raise ValueError("Number of lines must be non-negative")
7 result = pattern(lines)
8 print(result)
9 except ValueError as e:
10 if "invalid literal" in str(e):
11 print(f"Error: Please enter a valid integer number. {e}")
12 else:
13 print(f"Error: {e}")
14 except Exception as e:
15 print(f"An unexpected error occurred: {e}")
16
17
18def pattern(lines: int) -> str:

Callers 1

new_pattern.pyFile · 0.70

Calls 1

patternFunction · 0.70

Tested by

no test coverage detected