[英]About calling functions
import random
tur = ['alfa', 'sayı', 'diğer']
alfabe = ['a', 'b', 'c', 'ç', 'd', 'e', 'f', 'g', 'ğ', 'h', 'ı', 'i', 'j', 'k',
'l', 'm', 'n', 'o', 'ö', 'p', 'r', 's', 'ş', 't', 'u', 'ü', 'v', 'y',
'z', 'A', 'B', 'C', 'Ç', 'D', 'E', 'F', 'G', 'Ğ', 'H', 'I', 'İ', 'J',
'K', 'L', 'M', 'N', 'O', 'Ö', 'P', 'R', 'S', 'Ş', 'T', 'U', 'Ü', 'V',
'Y', 'Z']
sayilar = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
# Klavyeden basılabilecek alfasayısal olmayan karakterler
alfa_sayisal_degil=['!', '"', '#', '$', '%', '&', "'", '(', ')', '*', '+', ',',
'-', '.', '/', ':', ';', '<', '=', '>', '?', '@', '[',
'\\', ']', '^', '_', '`', '{', '|', '}', '~']
#/////////////////////////////////////////////////////////////////////////////////////////////
def alfabe_uret(zınk):
list=[i for i in alfabe]
zınk=random.choice(list)
print(zınk)
def sayi_uret(zınk2):
Liste = [i for i in sayilar]
zınk2=random.choice(Liste)
print(zınk2)
def alfsaydegil_uret():
pass
return
def parola_uret():
pass
return
print("Size önerebileceğimiz parola :")
print(sayi_uret)
print(alfabe_uret)
When I try to run this code I get this output.当我尝试运行这段代码时,我得到了这个 output。 How can I call those variables in those functions without these different numbers
如果没有这些不同的数字,我如何在这些函数中调用这些变量
<function sayi_uret at 0x039FFBB8>
<function alfabe_uret at 0x039EAF60>
Replace your last few lines with this:用这个替换你的最后几行:
print(sayi_uret())
print(alfabe_uret())
Currently the functions aren't being executed.目前这些功能没有被执行。
You didn't call the functions.你没有调用函数。 Just replace
只需更换
print(sayi_uret)
print(alfabe_uret)
with和
print(sayi_uret())
print(alfabe_uret())
You must remove the function arguments as they are unused:您必须删除 function arguments 因为它们未使用:
def alfabe_uret():
list=[i for i in alfabe]
zınk=random.choice(list)
print(zınk)
def sayi_uret():
Liste = [i for i in sayilar]
zınk2=random.choice(Liste)
print(zınk2)
here is the fixed code (the functions were defined wrong):这是固定代码(函数定义错误):
import random
tur = ['alfa', 'sayı', 'diğer']
alfabe = ['a', 'b', 'c', 'ç', 'd', 'e', 'f', 'g', 'ğ', 'h', 'ı', 'i','j', 'k','l', 'm', 'n', 'o', 'ö', 'p', 'r', 's', 'ş', 't', 'u', 'ü', 'v', 'y','z', 'A', 'B', 'C', 'Ç', 'D', 'E', 'F', 'G', 'Ğ', 'H', 'I', 'İ', 'J','K', 'L', 'M', 'N', 'O', 'Ö', 'P', 'R', 'S', 'Ş', 'T', 'U', 'Ü', 'V','Y', 'Z']
sayilar = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
alfa_sayisal_degil=['!', '"', '#', '$', '%', '&', "'", '(', ')', '*', '+', ',','-', '.', '/', ':', ';', '<', '=', '>', '?', '@', '[','\\', ']', '^', '_', '`', '{', '|', '}', '~']
def alfabe_uret():
list=[i for i in alfabe]
zınk=random.choice(list)
return zınk
def sayi_uret():
Liste = [i for i in sayilar]
zınk2=random.choice(Liste)
return zınk2
def alfsaydegil_uret():
pass
return
def parola_uret():
pass
return
print("Size önerebileceğimiz parola :")
print(sayi_uret())
print(alfabe_uret())
This is how it should be这是应该的
import random
tur = ['alfa', 'sayı', 'diğer']
alfabe = ['a', 'b', 'c', 'ç', 'd', 'e', 'f', 'g', 'ğ', 'h', 'ı', 'i', 'j', 'k',
'l', 'm', 'n', 'o', 'ö', 'p', 'r', 's', 'ş', 't', 'u', 'ü', 'v', 'y',
'z', 'A', 'B', 'C', 'Ç', 'D', 'E', 'F', 'G', 'Ğ', 'H', 'I', 'İ', 'J',
'K', 'L', 'M', 'N', 'O', 'Ö', 'P', 'R', 'S', 'Ş', 'T', 'U', 'Ü', 'V',
'Y', 'Z']
sayilar = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
# Klavyeden basılabilecek alfasayısal olmayan karakterler
alfa_sayisal_degil=['!', '"', '#', '$', '%', '&', "'", '(', ')', '*', '+',
',',
'-', '.', '/', ':', ';', '<', '=', '>', '?', '@', '[',
'\\', ']', '^', '_', '`', '{', '|', '}', '~']
def alfabe_uret():
list=[i for i in alfabe]
zınk=random.choice(list)
return (zınk)
def sayi_uret():
Liste = [i for i in sayilar]
zınk2=random.choice(Liste)
return zınk2
def alfsaydegil_uret():
pass
return
def parola_uret():
pass
return
print("Size önerebileceğimiz parola :")
print(sayi_uret())
print(alfabe_uret())
Output Output
Size önerebileceğimiz parola :
3
B
replace the last two print statement as:将最后两个打印语句替换为:
print(sayi_uret())
print(alfabe_uret())
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.