Hello,
I am a python newbie and I am trying to accommodate to the basics.
What's the python equivalent for the following Java snippet ?
Java:
public class Main {
public static void main(String args[]){
int a,b,c;
a= (int) (Math.random()*100);
c=0;
while((b=(int)(Math.random()*100))!=a){
c+=1;
}
System.out.println(c);
}
}
I was trying to create something similar in python, but I've encountered some errors.
This is the Python code with errors:
import random
a=int(random.triangular(1,100))
c=0
while(b=int(random.triangular(1,100))!=a:
c+=1
print(c)