To get var from another def | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

To get var from another def

Hy, guys. Please, help me. I write code and I need to use result var from one def in a new def. How can I get this var in a new diff Example: def input_data() : X=input() Def check_condition() : X=?

22nd Sep 2019, 1:16 PM
Павел Ефремов
Павел Ефремов - avatar
1 Answer
+ 1
~ swim ~ Thank you a lot for your answer. I would like to add my question. First function returns input, but I needto have only result of input. So if I try to use both fun1 and fun2, I have to input twice. And I need to have these functions separately. I try to reform next code into 2 functions. first one inputs data, second one checks data. password = input("Enter a password: ") # input data x=password if (validator.nums_check(x)==True and #complex of conditions to have correct password validator.length(x)==True and validator.spec_chars_check(x)==True and validator.space_check(x)==True and validator.upper_letters_check(x)==True and validator.lower_letters_check(x)==True): print("\nTrue") else: print("\nFalse\n") validator.print_check_list(x) I would be very thankful for answer 😊
22nd Sep 2019, 1:58 PM
Павел Ефремов
Павел Ефремов - avatar