Answer:
x = int(input("What grade are you in? "))
if (x == 9):
print ("Freshman")
elif (x == 10):
print("Sophomore")
elif (x == 11):
print ("Junior")
elif (x == 12):
print("Senior")
else:
print ("Not in High School")
Explanation:
Lets first work out how many different codes would be needed to represent everything. 26 for lowercase, 26 for uppercase, and 10 for 0-9. Total, that makes 62 needed codes.
If we start with 0, we need to go up to 61 to represent all the characters. Thus, we can convert 61 to binary and count the number of digits needed to represent that as the last number in the set and that will tell us how many digits are needed.
61 in binary is 111101, so we need 6 digits to represent that number. The answer is B.
Answer:
The delimiter use is "::".
Explanation:
The Java inbuilt String.split( ) function is use to split a String into an array of String.
The split( ) takes delimiter as arguments/parameter which determines at which point the string is to be broken down into different part/token.
From the above code snippet;
Each line in the file a.txt that is not null is splitted using the statement below:
String[ ] v = line.split("::");
The line is splitted using "::" as delimiter and the resulting array is then assigned to the variable 'v'.
For instance, a line in the file could take the form:
John::Smith::Music
When it is splitted,
String lname = John;
because lname make reference to index 0 of the array.
String fname = Smith;
because fname make reference to index 1 of the array.
String dept = Music;
and dept make reference to index 2 of the array.