Answer:
import java.util.*;
public class Country
{
public static void main(String args[])
{
char ch,temp;
int flag = 0;
String country;
ArrayList<String> countries = new ArrayList<String>();
Scanner sc = new Scanner(System.in);
do
{
System.out.println("enter the country you have visited:\t");
country = sc.next();
for(int i=0;i<countries.size();i++)
{
if(countries.get(i).equals(country))
{
System.out.println("you have already entered the country");
flag = 1;
break;
}
}
if(flag == 0)
{
countries.add(country);
flag = 0;
}
System.out.println("want to add another country(y/n):\t");
ch = sc.next().charAt(0);
}while(ch!='n');
Collections.sort(countries);
System.out.println("Countries you have visited:\t"+countries);
System.out.println("Total number of contries visited:"+countries.size());
}
}
Explanation:
Answer:
It depends on the situation
import "from random import randrange"
for printing random numbers between integers "random.randrange(num1, num2"
Syntax:
"random.randrange(start, stop, step)"
Parameter Values:
start - optional - an integer defining which position to start - default = 0
stop - required - an integer defining which position to end.
step - optional - an integer define the incrementation - default = 1
Explanation:
The syntax is a bit weird but I hope I was a help
Answer:
choice c
Explanation:
score = score + 10
because the rest doesn't make since and score == score + 10 has an extra equal sign.
def dx(fn, x, delta=0.001):
return (fn(x+delta) - fn(x))/delta
def solve(fn, value, x=0.5, maxtries=1000, maxerr=0.00001):
for tries in xrange(maxtries):
err = fn(x) - value
if abs(err) < maxerr:
return x
slope = dx(fn, x)
x -= err/slope
raise ValueError('no solution found')
Answer:
Looking closely at the HTML code sequence, it does seem that the tag element is the endpoint from where the HTML form gets the input, like input boxes, checkboxes, radio buttons, etc. And hence it is correct to say that the tag elements are the last one used in the HTML code sequence. And in the HTML code sequence head title script and styles comes at the top, and hence we mention the script or the Javascript code basically at the last, such that the HTML code or the web page run one time at least.
Explanation:
Please check the answer section.