java to python converter online

Solutions on MaxInterview for java to python converter online by the best coders in the world

showing results for - "java to python converter online"
Vanessa
15 Feb 2018
1import java.util.*;
2class D
3{
4public static void main(string args[])
5}
6int a[]=new int[5];
7int b[]=new int[5];
8Scanner kb=new Sacnner(System.in;
9for(intcj=0;j<=2;j++)
10{
11a[j]=kb.nextInt();
12for(int k=0;k<=2;k++)
13}
14b[k]=kb.nextInt();
15}
16int r1=a[2];
17int r2=a[2];
18double x=3.14*(double)r1*r1;  
19double y=3.14*(double)r2*r2;
20double sum=x+y;
21double ans=(1.813/sum)*100;
22System.out.printf("%.2f",ans);
Perrine
23 Oct 2019
1import java.io.*;
2import java.util.*;
3
4public class HuxleyCode {
5  public static void main(String args[]) {
6    Scanner input = new Scanner(System.in);
7
8    int x = input.nextInt();
9    int y = input.nextInt();
10    int total = 0;
11
12    for(int count = 1; count < 50; count++){
13      if(count % x == 0 && count % y == 0)
14        total = total + 1;
15    }
16
17    System.out.printf("%d", total);
18  }
19}
Julián
24 Mar 2019
1import java.util.*;
2public class fungsiA {
3
4    public static void main(String args []) throws InterruptedException {
5        Scanner sc = new Scanner(System.in);
6        int n;
7        System.out.print("Masukkan N :");
8        n = sc.nextInt();
9        long starTime = System.nanoTime();
10        for (int i = 1; i <= n; i = i + 2) {
11            for (int j = 1; j <= n/2; j++) {
12                System.out.println(2);
13            }
14        }
15        long endTime = System.nanoTime();
16        long totalTime = (endTime - starTime) / 1000000;
17        System.out.println("Total Time : " + totalTime + " milliseconds or " + (totalTime / 1000) + " seconds");
18    }
19}
Ivan
27 Nov 2018
1class TestFirewallRules(unittest.TestCase):
2    """ Test class to call Firewall Access Rules API functions """
3
4    def setUp(self):
5        if not os.path.exists(configFile):
6            raise unittest.SkipTest(
7                'External configuration not available, skipping...')
8        self.crn = os.getenv("CRN")
9        self.zone_id = os.getenv("ZONE_ID")
10        self.endpoint = os.getenv("API_ENDPOINT")
11        self.x_auth_user_token = os.getenv("CIS_SERVICES_APIKEY")
12        self.rule = FirewallRulesV1.new_instance(service_name='cis_services')
13        self.service = FiltersV1.new_instance(
14            service_name="cis_services")
15        self.service.set_service_url(self.endpoint)
16        self.rule.set_service_url(self.endpoint)
17        self._clean_firewall_rules()
18        self._clean_filters()
Shana
08 Feb 2018
1
2
3#import libraries
4import os, subprocess, time, shutil
5from datetime import datetime
6
7#format date to nonflex standard
8def formatdate(date, time):
9    input= date+time
10    output= datetime.strptime(input, "%d%b%y%H:%M:%S:").strftime("%m/%d/%Y|%H:%M:%S")
11    return output
12
13# stop the service, copy the log file to C:\NonFlex\RotatedLogs and start service
14service_status = subprocess.run(['sc', 'stop', 'ghs_lm'])
15time.sleep(10)
16shutil.move("C:\\NonFlex\\DebugLogs\\ghs.dl.rtf","C:\\NonFlex\\RotatedLogs\\"+"ghslm_"+str(datetime.now().strftime("%Y%m%d"))+"_ts-apps15.rl")
17service_status = subprocess.run(['sc', 'start', 'ghs_lm'])
18
19#pass log file into script
20filename = ("C:\\NonFlex\\RotatedLogs\\"+"ghslm_"+str(datetime.now().strftime("%Y%m%d"))+"_ts-apps15.rl")
21with open(filename) as g:
22    content = g.readlines()
23
24#create log file for output
25filename = ("C:\\NonFlex\\ReportLogs\\"+"ghslm_"+str(datetime.now().strftime("%Y%m%d"))+"_ts-apps15.log")
26f= open(filename,"w+")
27
28#parse the lines in the file
29for line in content:
30    line=line.split()
31    try:
32        date=formatdate(line[0],line[1])
33    except:
34        continue
35    #process license checkouts | working
36    if "granted" in line:
37        username=(line[8].split("@")[0])
38        ipaddress=(line[8].split("@")[1])
39        feature=line[3]
40        f.write(date+"|OUT|"+feature+"|1|0|"+username+"|"+ipaddress+"\n")
41    #process license checkins
42    if "exit" in line or "released" in line:
43        #process checkin
44        if line[2]=="exit":
45            username=(line[4].split("@")[0])
46            ipaddress=(line[4].split("@")[1])
47            feature=line[3]
48        else:
49            username=(line[2].split("@")[0])
50            ipaddress=(line[2].split("@")[1])
51            feature=line[4]     
52        f.write(date+"|IN|"+feature+"|1|0|"+username+"|"+ipaddress+"\n")
53    #log license startup| Working
54    if "Starting" in line and "License" in line:
55        f.write(formatdate(line[0],line[1])+"|START"+"\n")
56    #log license shutdowns| Working
57    if "Exiting" in line:
58        f.write(formatdate(line[0],line[1])+"|END"+"\n")
59    if "Feature" in line:
60        date=formatdate(line[0],line[1])
61        quantity=line[5]
62        feature=(line[4][1:-2])
63        f.write(date+"|FEATURE|"+feature+"|"+quantity+"\n")
64
65#close file and copy to \\orl4dfsns1.us.lmco.com\orlando\scoc_dfs\LicAdm\NonFlexPC
66f.close()
67shutil.copyfile(filename,"\\\\orl4dfsns1.us.lmco.com\\orlando\\scoc_dfs\\LicAdm\\NonFlexPC\\"+"ghslm_"+str(datetime.now().strftime("%Y%m%d"))+"_ts-apps15.log")
68