Ryan should apply a filter/criteria on the Courses column and view all the courses that show Sociology
Answer:
Explanation:
We can use for-loop in python to calculate the tuition amount in the next 5 years. If the tuition is increasing 3% each year, in each loop we can multiply the amount by 1.03
tuition = 8000
for year in range(1,6):
tuition *= 1.03
print("The tuition amount after " + str(year) + " year(s) is $" + str(tuition))
Answer:
Here is the Python program:
d = {5:3, 4:1, 12:2}
val_of_max = d[max(d.keys())]
print(val_of_max)
Explanation:
The program works as follows:
So we have a dictionary named d which is not empty and has the following key-value pairs:
5:3
4:1
12:2
where 5 , 4 and 12 are the keys and 3, 1 and 2 are the values
As we can see that the largest key is 12. So in order to find the largest key we use max() method which returns the largest key in the dictionary and we also use keys() which returns a view object i.e. the key of dictionary. So
max(d.keys()) as a whole gives 12
Next d[max(d.keys())] returns the corresponding value of this largest key. The corresponding value is 2 so this entire statement gives 2.
val_of_max = d[max(d.keys())] Thus this complete statement gives 2 and assigns to the val_of_max variable.
Next print(val_of_max) displays 2 on the output screen.
The screenshot of program along with its output is attached.
Answer:
public ArrayList onlyBlue(String[] clothes){
ArrayList<String> blueCloths = new ArrayList<>();
for(int i =0; i<clothes.length; i++){
if(clothes[i].equalsIgnoreCase("blue")){
blueCloths.add(clothes[i]);
}
}
return blueCloths;
}
Explanation:
- Create the method to accept an Array object of type String representing colors with a return type of an ArrayList
- Within the method body, create and initialize an Arraylist
- Use a for loop to iterate the Array of cloths.
- Use an if statement within the for loop to check if item equals blue and add to the Arraylist.
- Finally return the arrayList to the caller
Isopropyl is: CH3 - CH - CH3
|
Heptane is: CH3 - CH2 - CH2 - CH2 - CH2 - CH2 - CH3
Then 2,2 isopropyl heptane is:
CH3 - CH - CH3
|
CH3 - C - CH2 - CH2 - CH2 - CH2 - CH3
|
CH3 - CH - CH3.
There you can count that the longest carbon chain has 8 carbon atoms.
So the right name is of an octane.
I will rearrange the chain to show the 8 carbon chain in a row:
CH3 CH3
| |
CH3 - CH - C - CH2 - CH2 - CH2 - CH2 - CH3
|
CH3 - CH - CH3
Now, you can see that the right name is 3 isopropyl - 2, 3 dimethyl octane