Answer:
# The below code is in python programming language.
if(numberOfSides==4): #check the value number of slide is equal to 4 or not.
isQuadrilateral=True # assignment statement for if condition
else:
isQuadrilateral=False # assignment statement for else condition
Explanation:
The above code is in python language in which--
- The first lines are the "if" condition which checks the value of "numberofslides" variable.
- The second lines assign true in "isQuadrilateral" variable if "if" condition is true.
- The third line is for "else" statement that executes when the "if" condition is false.
- The fourth line is for "else" statement which assigns the value false to the numberofslides variables.
Answer:
import re
def country_capita():
#opens file
file=open("inputfile.txt", "r")
dictionary=dict()
#reads line by line
for line in file.readlines():
# substitutes for multiple space a single space
line = re.sub(r"[\s]{2, }", ' ', line)
list=[]
#splits line on space
list=line.split(" ")
#put into dictionary
dictionary[list[1]]=list[2]
# get input
while True:
choice=input("Enter the country name or quit to exit: ")
if choice=="quit":
break
elif choice in dictionary.keys():
print(dictionary[choice])
else:
print("Invalid Country")
country_capita()
Explanation:
Using python to code this program. First we, (line 1) import the re module which offers us a set of functions that allows us to search a string for a match. ((line 2) Next we define a function country_capita() that will open rawdata_2004.txt, read the information within line by line and create a dictionary list. The we create a while loop with conditional statements that prompt the user to enter country names, print the corresponding values and stops when the user enters quit.
The correction is C.
One of the major factors that determine the quality of a printer is the resolution of that printer. The resolution is also called DPI [Dots Per Inch]. The DPI refers to amount of ink that an inkjet printer can place in a one inch line of a printed document. The higher the DPI of a printer, the higher the resolution.