seedling tray generation script
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
#!/bin/python3
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
def ask_int(prompt: str) -> int:
|
||||
"""Prompt user for a positive integer."""
|
||||
while True:
|
||||
try:
|
||||
value = int(input(prompt).strip())
|
||||
if value <= 0:
|
||||
print("Please enter a positive integer.")
|
||||
continue
|
||||
return value
|
||||
except ValueError:
|
||||
print("Please enter a valid integer.")
|
||||
|
||||
|
||||
def ask_float(prompt: str) -> float:
|
||||
"""Prompt user for a positive float."""
|
||||
while True:
|
||||
try:
|
||||
value = float(input(prompt).strip())
|
||||
if value <= 0:
|
||||
print("Please enter a positive number.")
|
||||
continue
|
||||
return value
|
||||
except ValueError:
|
||||
print("Please enter a valid number.")
|
||||
Reference in New Issue
Block a user