Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

java to python

#include<stdio.h>
int stack[10000000]={0};
int top=-1;
 
void push(int c)
{
    stack[++top]=c;
}
 
void pop()
{
    stack[top--]=0;
}
 
int main()
{
    int N,max=0;
    int order=1;
    scanf("%d",&N);
    int arr[N];
    for(int i=0;i<N;i++)
    {
        scanf("%d",&arr[i]);
        if(max<arr[i])
        max=arr[i];
    }
    
    for(int i=0;i<N;i++)
    {
        while(top!=-1 && stack[top]==order)
        {
            order++;
            pop();
        }
        if(arr[i]==order)
        {
            order++;
          
        }
        else
        push(arr[i]);
        
    }
      while(top!=-1 && stack[top]==order)
        {
            order++;
            pop();
        }
    
    if(order==max+1)
    printf("Happy");
    else
    printf("Sad");
    
    
}
Comment

java to python

div body #java-to-python {
	font-size: max(blue, 20rem, min(red, calc(yellow + 200%)));
}
Comment

java to python

public class testint
	{
	    public static void main(String[] args)
	    {
	            boolean contain= false;
	            int valeurATrouver=5;
	            int ints[] ={1,4,5};
	     
	        for(int i=0;i<ints.length;i++)
	        {
	            if(ints[i]==valeurATrouver)
	            {
	                contain=true;
	            }
	        }
	        if(contain){System.out.println("La valeur "+valeurATrouver+" est comprise dans le tableau");}
	        else{System.out.println("La valeur "+valeurATrouver+" n'est pas comprise dans le tableau");}
	    }
	}
Comment

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]))
Comment

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)
Comment

PREVIOUS NEXT
Code Example
Python :: write dict to json file with special characters 
Python :: relative import package/module __init__.py 
Python :: python increment char a to b az to ba 
Python :: list value extraction using python 
Python :: Printers Stampanti 
Python :: Quality Control in python 
Python :: eeetimetable 
Python :: dataproc initialization_actions error 
Python :: Python-Generating numbers according to a corellation matrix 
Python :: tessa thompson 
Python :: python map function using lambda function as one of the parameters 
Python :: add variable in text python 
Python :: value counts normalize 
Python :: python list all youtube channel videos 
Python :: python open multiple .py windows 
Python :: python save console state 
Python :: TypeError: sequence item 1: expected str instance, NoneType found 
Python :: Python - Cómo comprobar si dos cuerdas son anagramas 
Python :: how to import autpy 
Python :: check for the negative integers and float 
Python :: wget download file python magic 
Python :: python use var in another function 
Python :: convert .tiff image stack to unit8 format 
Python :: python .exe long start 
Python :: python pycharm 
Python :: =adaqtar 
Python :: python regex replace point with underscore 
Python :: 400/15 
Python :: python list safely pop 
Python :: python read file to eof 
ADD CONTENT
Topic
Content
Source link
Name
5+8 =