Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Python Expert

Python Assignment -

Q1. Given 20 students, 10 of them are males, rest are females. We assign each of them an unique ID from 0 to 19. If the ID is an odd number, we determine that this is a male, otherwise is a female. We want first 10 students go to Northeastern, others go to Midwestern. Create a function named as "gender_geo( )" to show your outputs. Add your comments for each line of your code. Write your code in Jupyter notebook. Submit both PDF and Latex. sample_output.png file is how the outcome look like.

Q2. Solve ALL "Try it yourself" problems on page 29 from Python Crash Course book by using Python. Add your comments for each line of your code. Write your code in Jupyter notebook. Submit both PDF and Latex.

1. Personal Message: Store a person's name in a variable, and print a message to that person. Your message should be simple, such as, "Hello Eric, would you like to learn some Python today?"

2. Name Cases: Store a person's name in a variable, and then print that person's name in lowercase, uppercase, and titlecase.

3. Famous Quote: Find a quote from a famous person you admire. Print the quote and the name of its author. Your output should look something like the following, including the quotation marks:

Albert Einstein once said, "A person who never made a mistake never tried anything new."

4. Famous Quote 2: Repeat Exercise 2-5, but this time store the famous person's name in a variable called famous_person . Then compose your message and store it in a new variable called message. Print your message.

5. Stripping Names: Store a person's name, and include some whitespace characters at the beginning and end of the name. Make sure you use each character combination, "\t" and "\n", at least once.

Print the name once, so the whitespace around the name is displayed. Then print the name using each of the three stripping functions, lstrip(), rstrip(), and strip().

Q3. Solve "Try it yourself" problems

1) Every Function: Think of something you could store in a list. For example, you could make a list of mountains, rivers, countries, cities, languages, or any-thing else you'd like. Write a program that creates a list containing these items and then uses each function introduced in this chapter at least once.

2) Animals: Think of at least three different animals that have a common characteristic. Store the names of these animals in a list, and then use a for loop to print out the name of each animal.

  • Modify your program to print a statement about each animal, such as A dog would make a great pet.
  • Add a line at the end of your program stating what these animals have in common. You could print a sentence such as Any of these animals would make a great pet!

3) Buffet: A buffet-style restaurant offers only five basic foods. Think of five simple foods, and store them in a tuple.

  • Use a for loop to print each food the restaurant offers.
  • Try to modify one of the items, and make sure that Python rejects the change.
  • The restaurant changes its menu, replacing two of the items with different foods . Add a block of code that rewrites the tuple, and then use a for loop to print each of the items on the revised menu.

From Python Crash Course book by using Python. Add your comments for each line of your code. Write your code in Jupyter notebook. Submit both PDF and Latex.

Q4. Solve ALL "Try it yourself" problems on page 102 from Python Crash Course book by using Python. Add your comments for each line of your code. Write your code in Jupyter notebook. Submit both PDF and Latex.

1. Person: Use a dictionary to store information about a person you know. Store their first name, last name, age, and the city in which they live. You should have keys such as first_name, last_name, age, and city. Print each piece of information stored in your dictionary.

2. Favorite Numbers: Use a dictionary to store people's favorite numbers. Think of five names, and use them as keys in your dictionary. Think of a favorite number for each person, and store each as a value in your dictionary. Print each person's name and their favorite number. For even more fun, poll a few friends and get some actual data for your program.

3. Glossary: A Python dictionary can be used to model an actual dictionary. However, to avoid confusion, let's call it a glossary.

  • Think of five programming words you've learned about in the previous chapters. Use these words as the keys in your glossary, and store their meanings as values.
  • Print each word and its meaning as neatly formatted output. You might print the word followed by a colon and then its meaning, or print the word on one line and then print its meaning indented on a second line. Use the newline character (\n) to insert a blank line between each word-meaning pair in your output.

5. In your notebook cell, do the following tasks:

  • type "import this", and then run the cell. You will find "The Zen of Python". Read it very quickly.
  • Select two or three sentences that you love. Create a program to show how many words of your selected sentences. Typically, your outputs need to show "The user entered:" following by your sentences, and "The number of words in the sentence is" following by the number.
  • Create a program to show how many time each word in your sentences appeared. Note you need to show ALL of the words, and ALL lower cases.
  • This time add title and author "The Zen of Python, by Tim Peters" after your sentences, and then redo task 3.
  • Write down what your learned from "Zen of Python" in Markdown format.

Please follow instructions on the work provide.

Python Crash Course Book - A hands-on, Project-Based Introduction to Programming by Eric Matthes.

Attachment:- Assignment Files.rar

Python, Programming

  • Category:- Python
  • Reference No.:- M92739511
  • Price:- $90

Guranteed 48 Hours Delivery, In Price:- $90

Have any Question?


Related Questions in Python

Architecture and system integrationcase study queensland

Architecture and System Integration Case Study: Queensland Health - eHealth Investment Strategy After evaluating various platforms, Queensland Health finally decided to adopt a Service Oriented Architecture (SOA) for its ...

In this programming assignment you will write a client

In this programming assignment, you will write a client pingprogram in Python. Your client will send a simple ping message to a server, receive a correspondingpong message back from the server, and determine the delay be ...

Homework -this homework will have both a short written and

Homework - This homework will have, both a short written and coding assignment. The problems that are supposed to be written are clearly marked. 1) (Written) Make heuristics Describe two heuristics for the slide problem ...

Environment setupthe first mini project will be based on

Environment Setup The first mini project will be based on Ladder Logic programming. We will be using Schneider Electric's IDE called SoMachine Basic to do the programming. The latest ver- sion of SoMachine Basic for Wind ...

Simple python traffic lightswrite a program that simulates

Simple Python (Traffic lights) Write a program that simulates a traffic light. The program lets the user select one of three lights: red, yellow, or green. When a radio button is selected, the light is turned on, and onl ...

Question why is software configuration management

Question : Why is software configuration management considered an umbrella activity in software engineering? Please include examples and supporting discussion. The response must be typed, single spaced, must be in times ...

Project reconnaissance and attack on ics

Project: Reconnaissance and Attack on ICS NetworksEnvironment Setup The second mini project will be based on Industrial Network Protocols, specifically the Modbus protocol. Please follow the instructions carefully to set ...

Architecture and system integrationcase study queensland

Architecture and System Integration Case Study: Queensland Health - eHealth Investment Strategy After evaluating various platforms, Queensland Health finally decided to adopt a Service Oriented Architecture (SOA) for its ...

Lab assignment -background - we have discussed in detail

Lab Assignment - Background - We have discussed, in detail, the function of Stacks and Queues and how they are specifically implemented in Python. To get a better understanding of the utility of these data structures, we ...

Question research pythons dictionary data type dictdiscuss

Question : Research Python's dictionary data type (dict). Discuss its interface and usage. Include examples. Discuss practical applications of dictionaries.

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As