Answer to Question #264357 in Python for Vera warren

Question #264357

The problem with this code is No module named 'prettytable'

can you show the correct code?



table = PrettyTable()


table.field_names = ["pokemon name", "type"]

table.add_row(["pikachu", "Electric"])

table.add_row(["sydney", "Dark"])

table.add_row(["charmander", "Fire"])

table.add_row(["squite", "Water"])

print(table)





1
Expert's answer
2021-11-11T07:32:00-0500

"""python -m pip install -U prettytable

  Firstly you need to install this package above

  $pip install PrettyTable

  $python -m pip install --upgrade pip

  Or try this one

  pip install prettytable

  or try code above

  maybe you should try it in windows command"""


#you will import this package


from prettytable import PrettyTable

table = PrettyTable()




table.field_names = ["pokemon name", "type"]


table.add_row(["pikachu", "Electric"])


table.add_row(["sydney", "Dark"])


table.add_row(["charmander", "Fire"])


table.add_row(["squite", "Water"])


print(table)


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS