python to java converter
print("heelo")
java to python converter
import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.PrintWriter; public class Morse { public static void main(String[] args) throws FileNotFoundException, IOException { try (PrintWriter saida = new PrintWriter("morse.out")) { BufferedReader entrada; entrada = new BufferedReader(new FileReader("morse.in")); String linha; String morse[] = {".-", "-...", "-.-.", "-..", ".", "..-.", "--.", "....", "..", ".---", "-.-", ".-..", "--", "-.", "---", ".--.", "--.-", ".-.", "...", "-", "..-", "...-", ".--", "-..-", "-.--", "--.."}; while ((linha = entrada.readLine()) != null) { String temp[] = linha.split(" "); int cont; String palavra = ""; for (String t : temp) { cont = 0; for (String p : morse) { if (t.equals(p)) { palavra += (char) (65 + cont); break; } cont++; } } saida.println(palavra); if (linha.equals("..-. .. --")) { break; } } entrada.close(); saida.close(); } } }
java to python
hrs = input("Enter Hours:") h = float(hrs) rph=float(input("Enter rate per hours:")) if hrs>40: print (40*rph +(h-40)*rph*1.5) else: print(h*rph)
Source: www.py4e.com
convert python code to java
import http import ssl from urllib.parse import urlparse import requests clientCrt = "<SSL files path>/GDLAPPSPublicCertificate.cer" clientKey = "<SSL files path>/GDLAPPSPrivateCertificateKey.key" url = "https://gdlapps.naturesweet.com/ws/simple/getDailyQualityYield" request_url="/ws/simple/getDailyQualityYield" method="GET" headers = {'Content-type': 'application/json'} body={} context = ssl.SSLContext() context.load_cert_chain(certfile=clientCrt,keyfile=clientKey) connection = http.client.HTTPSConnection(urlparse(url).hostname, port=443, context=context) connection.request(method=method, url=url,headers=headers,body=body) response = connection.getresponse() print(response.status, response.reason) data = response.read() print(data)
convert python code to java
for i in range(2,len(array)):
Source: www.codegrepper.com