+ 1

guys i need help to translate this code from pascal to python

assign (sub,'hlasy.txt'); reset (sub); pocetvolani:=0; suma:=0; while not(eof(sub)) do begin readln (sub,telcislo,doba); suma:=suma+doba; inc(pocetvolani); pole_cisel[pocetvolani]:=telcislo; dobavolania[pocetvolani]:=doba; end; close(sub); for i:=1 to 100 do begin for j:=(i+1) to 100 do begin if pole_cisel[i]=pole_cisel[j] then dobavolania[i]:=dobavolania[i]+dobavolania[j]; end; end; i:=1; while(i<=100) do begin if dobavolania[i]>dobavolania[i+1] then begin max:=dobavolania[i]; cislo_max_vklad:=pole_cisel[i]; pom:=dobavolania[i+1]; pom1:=pole_cisel[i+1]; dobavolania[i+1]:=dobavolania[i]; pole_cisel[i+1]:=pole_cisel[i]; dobavolania[i]:=pom; pole_cisel[i]:=pom1; end; inc(i); end; writeln('maximalna vlozena suma=',max,' z cisla ',cislo_max_vklad); writeln('pocet volani =',pocetvolani); writeln('celkova zozbierana suma',suma); readln; end.

13th Feb 2023, 3:51 PM
Matej
Matej - avatar
3 Antworten
+ 5
And after you've tried Sakshi 's suggestion, if the code doesn't work, you can copy it into the code playground and attach it here. Someone should be able to help.
14th Feb 2023, 12:49 AM
Ausgrindtube
Ausgrindtube - avatar
+ 3
I think chatgpt translate this code, please try
13th Feb 2023, 4:52 PM
Sakshi [Offline 🙃]
Sakshi [Offline 🙃] - avatar
+ 1
Yeah, code work. Thank you very much.
15th Feb 2023, 4:44 PM
Matej
Matej - avatar