Answers for "convert python to java"

0

convert python to java

import check50
import check50_java

@check50.check()
def book_exists():
    """Book.java exists."""
    check50.exists("Book.java")

@check50.check(book_exists)
def book_compiles():
    """Book.java compiles."""
    check50_java.compile("Book.java")

@check50.check()
def press_exists():
    """Press.java exists."""
    check50.exists("Press.java")

@check50.check(press_exists)
def press_compiles():
    """Press.java compiles."""
    check50_java.compile("Press.java")

@check50.check()
def vm_exists():
    """VendingMachine.java exists."""
    check50.exists("VendingMachine.java")

@check50.check(vm_exists)
def vm_compiles():
    """VendingMachine.java compiles."""
    check50_java.compile("VendingMachine.java")
Posted by: Guest on April-29-2021
0

convert python to java

s=input()
l=[]
s1='aeiou'
sum1=0
def snm(sum1):
    t=0
    while(sum1>0 or t>9):
        if(sum1==0):
            sum1=t
            t=0
        t=t+sum1%10
        sum1=sum1//10
    return t
Posted by: Guest on May-04-2021
0

convert python to java

s=input()
l=[]
s1='aeiou'
sum1=0
def snm(sum1):
    t=0
    while(sum1>0 or t>9):
        if(sum1==0):
            sum1=t
            t=0
        t=t+sum1%10
        sum1=sum1//10
    return t
    
for i in range(len(s)):
    if s[i] in s1:
        l.append(i)
for j in range(len(l)):
    k=l[j]*5
    sum1=0
    for h in range(1,k+1,2):
        sum1=sum1+h
    print(snm(sum1))
Posted by: Guest on April-18-2021
0

python to java converter

def SeatingStudents(arr):

  K = arr[0]
  occupied = arr[1:]

  rows = int(K/2)

  seats = []
  x = 0
  
  for i in range(rows):
    seats.append([])
    for j in range(2):
      if((x+1) in occupied):
        full_seat = True
      else:
        full_seat = False
      seats[i].append(str(full_seat))
      x+=1

  seating = 0
  for i in range(rows-1):
    if((seats[i][0] == str(False)) and (seats[i][1] == str(False))):
      seating+=1

    if((seats[i][0] == str(False)) and (seats[i+1][0] == str(False))):
      seating+=1

    if((seats[i][1] == str(False)) and (seats[i + 1][1] == str(False))):
      seating+=1
  
  if((seats[rows - 1][0] == str(False)) and (seats[rows - 1][1] == str(False))):
    seating+=1
  return seating

 
print(SeatingStudents([12, 2, 6, 7, 11]))
Posted by: Guest on May-28-2021
-1

convert python code to java

for i in range(2,len(array)):
Posted by: Guest on May-22-2021

Python Answers by Framework

Browse Popular Code Answers by Language