Instructions
Objective
Write a program to implement ham radio countries in Python.
Requirements and Specifications
Homework 2 – Ham Radio Countries
You are given two lists of country names. Each list is contained in a module that is separate from the module( program) you will write.
One list contains the countries you have worked (talked to); the other contains countries you have confirmed. The program will find and print all the countries that are in the worked list but not in the confirmed list. The number of countries not yet confirmed is 27.
Requirements:
- Import the country lists from the other two modules
- Do not allow any unhandled errors.
- Include a comment header and comments throughout the code
- Use the ‘standard’ method of naming variables
- Sort the results list in ascending order
- Format the output so it is in two columns
- Write the code neatly
- Display the results neatly
Source Code
from countries_confirmed_start import *
from countries_worked_start import *
# Fore ach country we worked with, filter and select
# only those that did not confirm
unconfirmed_countries = []
for country in worked_list:
if country not in confirmed_list:
unconfirmed_countries.append(country)
# Sort the results in ascending order
for i in range(len(unconfirmed_countries) - 1):
for j in range(i + 1, len(unconfirmed_countries)):
if unconfirmed_countries[i] > unconfirmed_countries[j]:
country = unconfirmed_countries[i]
unconfirmed_countries[i] = unconfirmed_countries[j]
unconfirmed_countries[j] = country
# Print in 2 columns right justified
next_column = 0
for country in unconfirmed_countries:
print(str(country[0]).rjust(30), end="")
next_column += 1
if next_column % 2 == 0:
print()
# Print in 2 columns left justified
print("\n")
next_column = 0
for country in unconfirmed_countries:
print(str(country[0]).ljust(30), end="")
next_column += 1
if next_column % 2 == 0:
print()
Similar Samples
Explore our Python assignment sample to see firsthand how our experts tackle complex programming challenges. Our samples demonstrate clear problem-solving approaches, adherence to best coding practices, and proficiency in Python libraries. Whether it's data analysis, web development, or algorithmic tasks, our samples showcase the quality and expertise we bring to every Python assignment.
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python