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

Part i the assignment filesone of the most important

Part I: The Assignment Files One of the most important outcomes of this assignment is that you understand the importance of testing. This assignment will follow an iterative development cycle. That means you will write a ...

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 ...

Tasksdemonstrate data scraping of a social network of

Tasks Demonstrate data scraping of a social network of choice. Develop technical documentation, including the development of the code & detailing the results. Provide a report on the findings, that includes research into ...

Assignment1 utilising python 3 build the following

Assignment 1. Utilising Python 3 Build the following regression models: - Decision Tree - Gradient Boosted Tree - Linear regression 2. Select a dataset (other than the example dataset given in section 3) and apply the De ...

Python programming assignment -you first need an abstract

Python Programming Assignment - You first need an abstract base class, called, Account which has the following attributes and methods: accountID: This attribute holds the ID assigned the account , if not provided set to ...

Learning outcomes lo3 - research develop and document a

Learning Outcomes LO3 - Research, develop, and document a basic security policy, and analyse, record, and resolve all security incidents LO4 - Identify and assess the threats to, and vulnerabilities of networks Assessmen ...

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.

Questionwhat is a python development frameworkgive 3

Question What is a python development framework? Give 3 examples python development framework used today. and explain which development framework is used in which industry.

Below zero - ice cream storethe local ice-cream store needs

Below Zero - ice cream store The local ice-cream store needs a new ordering system to improve customer service by streamlining the ordering process. The manager of the store has found that many orders are incorrect and s ...

The second task in this assignment is to create a python

The second task in this assignment is to create a Python program called pancakes.py that will determine the final order of a stack of pancakes after a series of flips.(PYTHON 3) Problem Task In this problem, your input w ...

  • 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