Modify your program to print a statement about each animal

Assignment Help Python Programming
Reference no: EM131900837

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

Reference no: EM131900837

Questions Cloud

Discuss at least two possible metrics or outcomes : Assume an organization wants to gauge the success of its total rewards program. Discuss at least two possible metrics or outcomes it might use.
How does enrico get you to sympathize with his dilemma : How does Enrico get you to sympathize with his dilemma? Which film techniques dramatize his predicament after he surfaces?
Discuss the national cultural profiles of saudi arabia : Discuss the national cultural profiles of Saudi Arabia, Mexico, and China that are relevant in cross-cultural business communications.
Discuss about an organization labor relations : Explain how an organization's labor relations and employee relations policies and practices impact the organization's total rewards programs.
Modify your program to print a statement about each animal : Animals: Think of at least three different animals that have a common characteristic. Modify your program to print a statement about each animal
How situational approach to leadership specifically applies : An explanation of how the Situational Approach to Leadership specifically applies to a project team that consists of such different individual outlooks.
Should the investor acquire the stock : If the market's required yield is 14 percent, what is the value of the stock for that investor. Should the investor acquire the stock?
Compare and contrast your companys ratios to industry : Calculate and analyze the following ratios for your selected company for the last two years from the SEC Form 10-K.
What are three risks and threats of the user domain : What are three risks and threats of the User Domain? Why do organizations have acceptable use policies (AUPs)?

Reviews

Write a Review

Python Programming Questions & Answers

  Write a python program to implement the diff command

Without using the system() function to call any bash commands, write a python program that will implement a simple version of the diff command.

  Write a program for checking a circle

Write a program for checking a circle program must either print "is a circle: YES" or "is a circle: NO", appropriately.

  Prepare a python program

Prepare a Python program which evaluates how many stuck numbers there are in a range of integers. The range will be input as two command-line arguments.

  Python atm program to enter account number

Write a simple Python ATM program. Ask user to enter their account number, and print their initail balance. (Just make one up). Ask them if they wish to make deposit or withdrawal.

  Python function to calculate two roots

Write a Python function main() to calculate two roots. You must input a,b and c from keyboard, and then print two roots. Suppose the discriminant D= b2-4ac is positive.

  Design program that asks user to enter amount in python

IN Python Design a program that asks the user to enter the amount that he or she has budget in a month. A loop should then prompt the user to enter his or her expenses for the month.

  Write python program which imports three dictionaries

Write a Python program called hours.py which imports three dictionaries, and uses the data in them to calculate how many hours each person has spent in the lab.

  Write python program to create factors of numbers

Write down a python program which takes two numbers and creates the factors of both numbers and displays the greatest common factor.

  Email spam filter

Analyze the emails and predict whether the mail is a spam or not a spam - Create a training file and copy the text of several mails and spams in to it And create a test set identical to the training set but with different examples.

  Improve the readability and structural design of the code

Improve the readability and structural design of the code by improving the function names, variables, and loops, as well as whitespace. Move functions close to related functions or blocks of code related to your organised code.

  Create a simple and responsive gui

Please use primarily PHP or Python to solve the exercise and create a simple and responsive GUI, using HTML, CSS and JavaScript.Do not use a database.

  The program is to print the time

The program is to print the time in seconds that the iterative version takes, the time in seconds that the recursive version takes, and the difference between the times.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd