Created
April 2, 2022 14:58
-
-
Save YodaLightsabr/c31c3f64cc522f1133d8c44a54e6177a to your computer and use it in GitHub Desktop.
rici input getter thingy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def integer_input(range, inputs): # Integer input prompt | |
text = "" | |
if inputs > 1: | |
text = "Integers" | |
else: | |
text = "Integer" | |
print("<" + str(inputs) + " " + text + "> {Range: [" + str(range[0]) + ", " + str(range[1]) + "]}") | |
print("") | |
data = input() | |
if inputs > 1: | |
data = data.split(" ") | |
else: | |
data = [data] | |
if len(data) != inputs: | |
print("Requires " + str(inputs) + " inputs seperated by space") | |
return integer_input(range, inputs) | |
value = data | |
for data in value: | |
if data.isdigit(): | |
data = int(data) | |
if data >= range[0] and data <= range[1]: | |
a = "" | |
else: | |
print("Invalid range") | |
return integer_input(range, inputs) | |
else: | |
print("Invalid input") | |
return integer_input(range, inputs) | |
return value | |
def select_menu(options): # Select menu prompt | |
number = 1 | |
for option in options: | |
print("[" + str(number) + "] " + option) | |
number += 1 | |
return integer_input([1, len(options)], 1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment