3.4 lesson practice quiz edhesive
:
Write a program to check if user inputs "yellow"
Answer:
In Python:
col = input("Enter Color: ")
if col == "yellow":
print("True")
else:
print("False")
Explanation:
This prompts the user for color
col = input("Enter Color: ")
This checks if color is yellow
if col == "yellow":
If true, this prints true
print("True")
If otherwise, this prints false
else:
print("False")
False,
The Pop Color tool can be used to select one particular color, changing the rest of the image to black and white. The effects available in Photoshop Express don't allow for a huge amount of customization
Answer:
A unique identifier for a wireless subscriber
Answer:
- country_pop = {
- 'China': 1365830000,
- 'India': 1247220000,
- 'United States': 318463000,
- 'Indonesia': 252164800
- }
- for key in country_pop:
- print(key + " has " + str(country_pop[key]) + " people")
Explanation:
The solution code is written in Python 3.
Given a dictionary, country_pop with data that includes four country along with their respective population (Line 1-6). We can use for in loop structure to traverse through each of the key (country) in the dictionary and print their respective population value (Line 7-8). The general loop structure through is as follow:
for key in dict:
do something
One key will be addressed for each round of loop and we can use that key to extract the corresponding value of the key (e.g. country_pop[key]) and print it out.