“Konwerter transkoderowy dla Pythona do Java” Kod odpowiedzi

Konwerter transkoderowy dla Pythona do Java

def import_file(file):
    with open(file,"r") as f:
        lines = f.readlines()
        sline = []
        for line in lines:
          xline=line.split(" ")
          sline.append(xline)
    return sline        
        
def set_file(idf,q,sline):
    for i in sline:
        if idf in i:
            sline[sline.index(i)][1] = q + "\n"
            return "Change succeeded"
    sline.append([idf,q])
    return "New code added"

def list_file(idf,sline):
    for i in sline:
        if idf in i:
            return sline[sline.index(i)][1]
    return "Not found"       

def export_file(name,sline):
    with open(name,'w') as f:
        for lines in sline:
            f.write(lines[0] + ' ' + lines[1])
                                     
loop = 1
while loop == 1:
    choice=int(input("1:Import file\n 2:Set \n 3:List \n 4:Export file \n 5:Quit \n :"))
    if choice == 1:
        print("Importing file...")
        use=import_file(input("Insert the path of the file:"))
    elif choice == 2:
        print("Setting file...")
        print(set_file(input("Insert id:"),input("Insert quantity:"),use))
    elif choice == 3:
        print("Listing file...")
        print(list_file(input("Insert id:"),use))
        print(use)
    elif choice == 4:
        print("Exporting file...")
        print(export_file(input("Name of the exported file:"),use))
    elif choice == 5:
        print("Goodbye")
        loop = 0
    
Horrible Heron

Konwerter transkoderowy dla Pythona do Java

a,z,p=input().split(","),[],[]
a.sort(key=len)
n=[len(x) for x in a]
for i in range (len(a)):
    for j in range (i+1,len(a)):
        if (n[j]==2*[i]):z.append([a[i].a[j]])
        if not z:print(-1);quit()
        for x,k in z:
            for y in x:
                if y in k:p.append(y)
                if p:print(*sorted(p),sep=",")
                else:print(-1)
Charming Cottonmouth

Konwerter transkoderowy dla Pythona do Java

inarr = input().split(',')
for i in range(len(inarr)):
    if '6' in inarr[i]:
        inarr[i] = inarr[i].replace('6','9')
        inarr[i] = inarr[i][::-1]
sum = 0
for i in inarr:
    sum = sum + int(1)
outnum = round(sum/len(inarr),2)
print(outnum)
Aggressive Alpaca

Odpowiedzi podobne do “Konwerter transkoderowy dla Pythona do Java”

Pytania podobne do “Konwerter transkoderowy dla Pythona do Java”

Więcej pokrewnych odpowiedzi na “Konwerter transkoderowy dla Pythona do Java” w Java

Przeglądaj popularne odpowiedzi na kod według języka

Przeglądaj inne języki kodu