Question

I need to write a Python Program for the following question. Link for tallest mountains: https://en.wikipedia.org/wiki/List_of_mountains_by_elevation Use top 10 tallest mountains. Part One Wikipedia...

I need to write a Python Program for the following question.

Link for tallest mountains: https://en.wikipedia.org/wiki/List_of_mountains_by_elevation

Use top 10 tallest mountains.

Part One

  • Wikipedia has a list of the tallest mountains in the world each mountain's elevation. Pick 10 mountains from this list.
    • Create a dictionary with the mountain names as keys, and the elevations as values.
    • Print out just the mountains' names, by looping through the keys of your dictionary.
    • Print out just the mountains' elevations, by looping through the values of your dictionary.
    • Print out a series of statements telling how tall each mountain is: "Everest is 8848 meters tall."

Part Two

  • Revise your final output from Mountain Heights, so that the information is listed in alphabetical order by each mountain's name.
    • That is, print out a series of statements telling how tall each mountain is: "Everest is 8848 meters tall."
    • Make sure your output is in alphabetical order.

Part Three

  • This is an extension of Mountain Heights. Make sure you save this program under a different filename, such as mountain_heights_3.py, so that you can go back to your original program if you need to.
    • The list of tallest mountains in the world provided all elevations in meters. Convert each of these elevations to feet, given that a meter is approximately 3.28 feet. Make sure you use a function to do this conversion
    • Create a new dictionary, where the keys of the dictionary are still the mountains' names. This time however, the values of the dictionary should be a list of each mountain's elevation in meters, and then in feet: {'everest': [8848, 29029]}
    • Print out just the mountains' names, by looping through the keys of your dictionary.
    • Print out just the mountains' elevations in meters, by looping through the values of your dictionary and pulling out the first number from each list.
    • Print out just the mountains' elevations in feet, by looping through the values of your dictionary and pulling out the second number from each list.
    • Print out a series of statements telling how tall each mountain is: "Everest is 8848 meters tall, or 29029 feet."
0 0
Add a comment Improve this question Transcribed image text
Answer #1
mountains={"Mount Everest":8848,"K2":8611,"Kangchenjunga":8586,
          "Lhotse":8516,"Makalu":8485,"Cho Oyu":8201,"Dhaulagiri":8167,
          "Manaslu":8163,"Nanga Parbat":8126,"Annapurna":8091}

print("\n====PART 1=====")
#part 1
print("Mountain names: ")
for i in mountains.keys():
    print(i)

print("Elevations: ")
for i in mountains.values():
    print(i)

for i in mountains:
    print(i,"is",mountains[i],"meters tall")

#part 2
print("\n====PART 2=====")
for i in sorted(mountains.keys()):
    print(i,"is",mountains[i],"meters tall")

#part 3

mountains={"Mount Everest":8848,"K2":8611,"Kangchenjunga":8586,
          "Lhotse":8516,"Makalu":8485,"Cho Oyu":8201,"Dhaulagiri":8167,
          "Manaslu":8163,"Nanga Parbat":8126,"Annapurna":8091}

def m2f(m):
    return m*3.28
a={i:[mountains[i],m2f(mountains[i])] for i in mountains}

print("\n====Part 3====")
print("\nMountain names:")
for i in a:
    print(i)
print("\nElevations in meters:")
for i in a:
    print(a[i][0])
print("\nElevations in feet:")
for i in a:
    print(a[i][1])
print()
for i in a:
    print(i,"is",a[i][0],"meters tall, or",a[i][1],"feet")

Elevations in feet: 29021.44 28244.079999999998 28162.079999999998 27932.48 27830.8 26899.28 26787.76 26774.64 26653.28 26538

Add a comment
Know the answer?
Add Answer to:
I need to write a Python Program for the following question. Link for tallest mountains: https://en.wikipedia.org/wiki/List_of_mountains_by_elevation Use top 10 tallest mountains. Part One Wikipedia...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Use Python Spyder to answer: First List – Loop (one that you created in lab 1...

    Use Python Spyder to answer: First List – Loop (one that you created in lab 1 or any new list) • Repeat First List, but this time use a loop to print out each value in the list. First Neat List - Loop • Repeat First Neat List, but this time use a loop to print out your statements. Make sure you are writing the same sentence for all values in your list. Loops are not effective when you are...

  • Could anyone help add to my python code? I now need to calculate the mean and...

    Could anyone help add to my python code? I now need to calculate the mean and median. In this programming assignment you are to extend the program you wrote for Number Stats to determine the median and mode of the numbers read from the file. You are to create a program called numstat2.py that reads a series of integer numbers from a file and determines and displays the following: The name of the file. The sum of the numbers. The...

  • I really need help with this python programming assignment Program Requirements For part 2, i need...

    I really need help with this python programming assignment Program Requirements For part 2, i need the following functions • get floats(): It take a single integer argument and returns a list of floats. where it was something like this def get_floats(n):   lst = []   for i in range(1,n+1):     val = float(input('Enter float '+str(i)+': '))     lst.append(val)   return lst • summer(): This non-void function takes a single list argument, and returns the sum of the list. However, it does not use...

  • I need this in C++. This is all one question Program 2: Linked List Class For...

    I need this in C++. This is all one question Program 2: Linked List Class For this problem, let us take the linked list we wrote in a functional manner in a previous assignment and convert it into a Linked List class. For extra practice with pointers we'll expand its functionality and make it a doubly linked list with the ability to traverse in both directions. Since the list is doubly linked, each node will have the following structure: struct...

  • Python Help: Using the stock.py data, write a program that does the following: Create a NumPy...

    Python Help: Using the stock.py data, write a program that does the following: Create a NumPy array from the nasdaq list from stocks.py. Do the same with the other three lists from stocks.py. Thus, at the end of this tasks, you will have four NumPy arrays. Print out the type (that is, the object type, not the element type) of each array in #1 and the data type typecode of the elements in each array in #1. This task is...

  • Python program This assignment requires you to write a single large program. I have broken it...

    Python program This assignment requires you to write a single large program. I have broken it into two parts below as a suggestion for how to approach writing the code. Please turn in one program file. Sentiment Analysis is a Big Data problem which seeks to determine the general attitude of a writer given some text they have written. For instance, we would like to have a program that could look at the text "The film was a breath of...

  • Coding for Python – don’t need it to be complex: In this assignment, your goal is to write a Python program to determine whether a given pattern appears in a data series, and if so, where it is locate...

    Coding for Python – don’t need it to be complex: In this assignment, your goal is to write a Python program to determine whether a given pattern appears in a data series, and if so, where it is located in the data series. This type of problem is common in many health disciplines. For example, identifying treatment pathways. The goal is to detect whether a certain pattern appears in the data series. In the following example, the pattern to be...

  • Please use C programming to write the code to solve the following problem. Also, please use the i...

    Please use C programming to write the code to solve the following problem. Also, please use the instructions, functions, syntax and any other required part of the problem. Thanks in advance. Use these functions below especially: void inputStringFromUser(char *prompt, char *s, int arraySize); void songNameDuplicate(char *songName); void songNameFound(char *songName); void songNameNotFound(char *songName); void songNameDeleted(char *songName); void artistFound(char *artist); void artistNotFound(char *artist); void printMusicLibraryEmpty(void); void printMusicLibraryTitle(void); const int MAX_LENGTH = 1024; You will write a program that maintains information about your...

  • Mountain Paths (Part 1) Objectives 2d arrays Store Use Nested Loops Parallel data structures (i.e...

    Mountain Paths (Part 1) in C++ Objectives 2d arrays Store Use Nested Loops Parallel data structures (i.e. parallel arrays … called multiple arrays in the zyBook) Transform data Read from files Write to files structs Code Requirements Start with this code: mtnpathstart.zip Do not modify the function signatures provided. Do not #include or #include Program Flow Read the data into a 2D array Find min and max elevation to correspond to darkest and brightest color, respectively Compute the shade of...

  • Mountain Paths (Part 1) in C++ Objectives 2d arrays Store Use Nested Loops Parallel data structures...

    Mountain Paths (Part 1) in C++ Objectives 2d arrays Store Use Nested Loops Parallel data structures (i.e. parallel arrays … called multiple arrays in the zyBook) Transform data Read from files Write to files structs Code Requirements Start with this code: mtnpathstart.zip Do not modify the function signatures provided. Do not #include or #include Program Flow Read the data into a 2D array Find min and max elevation to correspond to darkest and brightest color, respectively Compute the shade of...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT