Python Forum
Python Homework Help *Urgent
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python Homework Help *Urgent
#1
Hello everyone, first time posting here and just wanted some help with some python homework. I've been taking a GIS college program which consists of learning python (I'm still a beginner and the program is accelerated (7-8 courses a semester) so I've had some trouble catching up. If anyone can help with these set of questions, I would appreciate it or at least how I would go about completing it would be great. The assignment is due in a couple of hours so I can use all the help I can get, thanks again for any help and PM me if anything.




Deliverable 7
Consider the following code segment

m = [ ‘have’, ‘fun’ ]

x, y = m

a. What are the values of x and y after the second line has been processed.

b. What python structure is x, y

c. In your own words, explain what is happening when line 2 is processed.

d. Write a line of code that swaps the values of x and y



2.

a. Add Python statements below each comment to sequentially do the tasks specified in the comments

# Assign your name to the variable myName # Create an empty dictionary

# Create a loop that uses the variable myName to traverse the letters # in your name, one at a time

# For each letter, check to see whether the letter is in the dictionary

# When the letter is not in the dictionary, create a new item in the dictionary # with the letter as the key and the value 1

# When the letter is in the dictionary, increment that letter’s value # in the dictionary by 1

# After all the letters in your name have been processed, display the dictionary



b. In your own words, explain the purpose of this code segment




3. The following code segment creates a Customer class

class Customer(object):

def init (self):

self.name = name

self.balance = balance

def withdraw(self, amount):





a. Modify the Customer class as instructed below

· Give the Customer object a name and an initial balance when the Customer object is created (instantiated).

· Change the withdrawal method to

‒ make sure the amount to be withdrawn is less than the available balance

‒ adjust the Customer’s current balance by the withdrawal amount

· Include a deposit method that adds the amount of the deposit to the Customer’s current balance





b. Create a short Python program that does the following, in the order listed

· Creates a customer object with your name and an initial balance of 0 dollars using the Customer class

· Displays the customer’s name and current balance

· Uses the deposit method on the customer with your name to deposit $300, then $200 and then $100

· Displays the customer’s name and current balance

· Uses the withdrawal method on the customer with your name to take out $150

· Displays the customer’s name and current balance

· Creates a second customer object with a different name from your name and an initial balance of $1000

· Uses the withdrawal method on the second customer to take out $400

· Displays the second customer’s name and current balance
Reply
#2
If you make a program that deposits all those amounts into my account, I'll do your homework for you. It's the only shot you have.

Try opening the book next time.
Reply
#3
What have you tried? We're not big on writing code for people here, but we would be happy to help you fix your code when you run into problems. When you do run into problems, please post your code in Python tags, and clearly explain the problem you are having, including the full text of any errors.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  HELP in python homework makashito 4 3,864 Oct-12-2021, 10:12 AM
Last Post: buran
Exclamation Python Homework (Urgent help needed!!) chickenseizuresalad 6 4,217 Oct-11-2021, 01:59 AM
Last Post: Underscore
  CyperSecurity Using Python HomeWork ward1995 1 1,931 Jul-08-2021, 03:55 PM
Last Post: buran
Exclamation urgent , Python homework alm 2 2,257 May-09-2021, 11:19 AM
Last Post: Yoriz
  urgent I got a syntax errors alm 2 5,793 Feb-28-2021, 02:54 PM
Last Post: alm
Heart Urgent homework help needed Medou 4 2,658 Nov-24-2020, 09:28 AM
Last Post: buran
  Homework with python Johnsonmfw 1 1,660 Sep-20-2020, 04:03 AM
Last Post: ndc85430
  [Urgent] build code GodMaster 2 1,768 Mar-23-2020, 12:25 AM
Last Post: jefsummers
  Bifid Genkey (Urgent) Laura123 2 2,016 Mar-09-2020, 08:09 PM
Last Post: micseydel
  Python Homework Question OrcDroid123 1 2,342 Sep-01-2019, 08:44 AM
Last Post: buran

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020