FUCNTION:
Calling function:
Please enter your ID: KM
KM does not contain 8 alphanumeric characters, please enter your ID again
Please enter your ID: KMkmkmkm
Thanks for the input KMkmkmkm
FUNCTION:
Calling Function:
Not Working:
CheckInput()
CheckInput(1)
Please enter your ID: KM000000
Thanks for the input KM000000
Not working:
CheckInput(1)
CheckInput()
Please enter your ID: KM000000
Thanks for the input KM000000
I need to use this function to validate my input in the below code:
How can I make that function call in the below code.
I need to validate the ID captured as in the below code and only then the next input() i.e doctor will be captured.
def CheckInput(ID): while True: ID = input("Please enter your ID: ") if len(ID) == 8: print("Thanks for the input ", ID) break else: print(ID, " does not contain 8 alphanumeric characters, please enter your ID again")
Calling function:
Error:CheckInput()
Traceback (most recent call last):
File "<ipython-input-11-6e7f44b6eb76>", line 1, in <module>
CheckInput()
TypeError: CheckInput() missing 1 required positional argument: 'ID'
CheckInput(1)Please enter your ID: KM
KM does not contain 8 alphanumeric characters, please enter your ID again
Please enter your ID: KMkmkmkm
Thanks for the input KMkmkmkm
FUNCTION:
def CheckInput(ID): while True: ID = input("Please enter your ID: ") if len(ID) == 8: print("Thanks for the input ", ID) break else: print(ID, " does not contain 8 alphanumeric characters, please enter your ID again")
Calling Function:
Not Working:
CheckInput()
Error:Traceback (most recent call last):
File "<ipython-input-14-6e7f44b6eb76>", line 1, in <module>
CheckInput()
TypeError: CheckInput() missing 1 required positional argument: 'ID'
Working:CheckInput(1)
Please enter your ID: KM000000
Thanks for the input KM000000
def CheckInput(): while True: ID = input("Please enter your ID: ") if len(ID) == 8: print("Thanks for the input ", ID) break else: print(ID, " does not contain 8 alphanumeric characters, please enter your ID again")
Not working:
CheckInput(1)
Error:Traceback (most recent call last):
File "<ipython-input-17-782b94db3014>", line 1, in <module>
CheckInput(1)
TypeError: CheckInput() takes 0 positional arguments but 1 was given
Working:CheckInput()
Please enter your ID: KM000000
Thanks for the input KM000000
I need to use this function to validate my input in the below code:
How can I make that function call in the below code.
I need to validate the ID captured as in the below code and only then the next input() i.e doctor will be captured.
import datetime from datetime import datetime n = 5 while n > 0: id = input("Please enter your ID: ") with open("C:\\Users\\ABCD\\EFG\\" "%s.txt" % id, "a") as file: ID = input("Please provide your ID: ") Doctor = input("Please provide the name of the doctor you would like to visit: ")Thanks