Answer:
See explanation
Explanation:
Given
The above program that subtracts two numbers and returns the result
Required
Modify the source code to run perfectly
When the given program is tested, it displays
<em>4 minus 10 equals -6
</em>
<em></em>
<em>Which is different from the expected output of</em>
<em>10 minus 4 equals 6
</em>
<em></em>
Modify
<em>solution = minuend-subtrahend
</em>
<em>to</em>
<em>solution = subtrahend - minuend</em>
<em></em>
And that does it.
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.
On scratch they feature a drag and drop form of coding to visualize it. You can create an account and drag and drop puzzle ties in the order. The first tile you’ll want to drag into the area is the “start program” tile and then you’ll need to connect tiles from there.
Hope this helped!
: a unit of spoken language that is next bigger than a speech sound and consists of one or more vowel sounds alone or of a syllabic consonant alone or of either with one or more consonant sounds preceding or following
2: one or more letters (such as syl, la, and ble) in a word (such as syl*la*ble) usually set off from the rest of the word by a centered dot or a hyphen and roughly corresponding to the syllables of spoken language and treated as helps to pronunciation or as guides to placing hyphens at the end of a line
3: the smallest conceivable expression or unit of something : JOT
4: SOL-FA SYLLABLES