Questions Uploads

Program: ASCII art (Python 3)

Untitled.png

Hi, Please I need help with these questions. I tried many times but codes are wrong. ATTACHMENT PREVIEW Download attachment

Untitled.png

Untitled.png

1.15 Program: ASCII art (Python 3) This zyLab activity is the traditional programming assignment, typically requiring a few hours over a week The previous sections provide warm up
exercises intended to help a student prepare for this programming assignment. (1 ) Output this tree. (Submit for 2 points). :-
\l-I-I-
lull-Inl-
wwwwwww ill- (2) Below the tree (with two blank lines), output this cat. (Submit for 3 points, so 5 points total}. 2"\ i\ Hint: A backslash \ in a string acts as an escape character, such as with a neMine \n. So, to print an actual backslash, escape mat backslash by
prepending another backslash. Ex: The following prints a single backslash: print ( ‘ \ \ ‘ J

Top Answer

 
Looking for a Similar Assignment? Order now and Get 10% Discount! Use Coupon Code "Newclient"

output the movie title

(1) Prompt the user to input a wall’s height and width. Calculate and output the wall’s area. (Submit for 2 points).

Enter wall height (feet): 12
Enter wall width (feet): 15
Wall area: 180.0 square feet

(2) Extend to also calculate and output the amount of paint in gallons needed to paint the wall. Assume a gallon of paint covers 350 square feet. Store this value in a variable. (Submit for 2 points, so 4 points total).

Enter wall height (feet): 12
Enter wall width (feet): 15
Wall area: 180.0 square feet
Paint needed: 0.5142857142857142 gallons

(3) Extend to also calculate and output the number of 1 gallon cans needed to paint the wall. Hint: Use a math function to round up to the nearest gallon. (Submit for 2 points, so 6 points total).

Enter wall height (feet): 12
Enter wall width (feet): 15
Wall area: 180.0 square feet
Paint needed: 0.5142857142857142 gallons
Cans needed: 1 can(s)

(4) Extend by prompting the user for a color they want to paint the walls. Calculate and output the total cost of the paint cans depending on which color is chosen. Hint: Use a dictionary to associate each paint color with its respective cost. Red paint costs $35 per gallon can, blue paint costs $25 per gallon can, and green paint costs $23 per gallon can. (Submit for 2 points, so 8 points total).

Enter wall height (feet): 12
Enter wall width (feet): 15
Wall area: 180.0 square feet
Paint needed: 0.5142857142857142 gallons
Cans needed: 1 can(s)

Choose a color to paint the wall: red
Cost of purchasing red paint: $35
 
Looking for a Similar Assignment? Order now and Get 10% Discount! Use Coupon Code "Newclient"

output the movie title

(1) Build a dictionary that contains the movie collection below. Hint: Combine movie title and director into a list. 

Year          Title                       Director

2005          Munich                      Steven Spielberg

2006          The Prestige                Christopher Nolan

2006          The Departed                Martin Scorsese

2007          Into the Wild               Sean Penn

2008          The Dark Knight             Christopher Nolan

2009          Mary and Max                Adam Elliot

2010          The King’s Speech           Tom Hooper

2011          The Artist                  Michel Hazanavicius

2011          The Help                    Tate Taylor

2012          Argo                        Ben Affleck

2013          12 Years a Slave            Steve McQueen

2014          Birdman                     Alejandro G. Inarritu

2015          Spotlight                   Tom McCarthy

2016          The BFG                     Steven Spielberg

(2) Prompt the user for a single year and output the movie title(s) and director(s) from that year. Output N/A if the year is invalid. (4 pts) 

Ex:

Enter a year between 2005 and 2016:

2011

The Artist, Michel Hazanavicius

The Help, Tate Taylor

(3) After prompting the user for a year and displaying the title(s) and directors(s) from that year, display a menu. The menu enables a user to display the movies sorted by year, director, or movie title. Each option is represented by a single character.

The program initially outputs the menu, and outputs the menu after a user chooses an option. If an invalid character is entered, continue to prompt for a valid choice. The program ends when the user chooses the option to Quit. Hint: Implement Quit before implementing other options. For this step, the other options do nothing. (1 pt) 

Ex:

Enter a year between 2005 and 2016:

2011

The Artist, Michel Hazanavicius

The Help, Tate Taylor

MENU

Sort by:

y – Year

d – Director

t – Movie title

q – Quit

Choose an option:

(4) Implement the sort by year menu option. Note: There is a newline and a tab between the year and the movie title/director. (2 pts) 

Ex:

Choose an option:

y

2005:

    Munich, Steven Spielberg

2006:

    The Prestige, Christopher Nolan

    The Departed, Martin Scorsese

2007:

    Into the Wild, Sean Penn

2008:

    The Dark Knight, Christopher Nolan

(5) Implement the sort by director menu option. For directors with multiple films on the list, order their films by year. Note: There is a newline and a tab between the director’s name and the movie title/year. (3 pts) 

Ex:

Choose an option:

d

Adam Elliot:

    Mary and Max, 2009

Alejandro G. Inarritu:

    Birdman, 2014

Ben Affleck:

    Argo, 2012

Christopher Nolan:

    The Dark Knight, 2008

    The Prestige, 2006

(6) Implement the sort by movie title menu option. Note: There is a newline and a tab between the movie title and the movie director/year. (2 pts) 

Ex:

Choose an option:

t

12 Years a Slave:

    Steve McQueen, 2013

Argo:

    Ben Affleck, 2012

Birdman:

    Alejandro G. Inarritu, 2014

Into the Wild:

    Sean Penn, 2007

My output:

1. Compare output

0/2

Input 2011
Your output starts with Enter a year between 2005 and 2016:  [[‘The Artist’, ‘Michel Hazanavicius’], [‘The Help’, ‘Tate Taylor’
Expected output starts with Enter a year between 2005 and 2016: The Artist, Michel Hazanavicius The Help, Tate Taylor

2. Compare output

0/1

Input 2007
Your output starts with Enter a year between 2005 and 2016:  [‘Into the Wild’, ‘Sean Penn’
Expected output starts with Enter a year between 2005 and 2016: Into the Wild, Sean Penn

3. Compare output

0/1

Input 2001
Your output starts with Enter a year between 2005 and 2016:
Expected output starts with Enter a year between 2005 and 2016: N/A

4. Compare output

0/1

Input 2015 q
Your output Enter a year between 2005 and 2016:  [‘Spotlight’, ‘Tom McCarthy’] Choose and option:
Expected output Enter a year between 2005 and 2016: Spotlight, Tom McCarthy   MENU Sort by: y – Year d – Director t – Movie title q – Quit   Choose an option:

5. Compare output

0/2

Input 2014 y q
Your output Enter a year between 2005 and 2016:  [‘Birdman’, ‘Alejandro G. Inarritu’] Choose and option:2013:      [’12 YearsaSlave’,’SteveMcQueen’] 2014:      [‘Birdman’, ‘AlejandroG. Inarritu’] 2016:      [‘The BFG’, ‘Steven Spielberg’] 2006:      [[‘The Prestige’, ‘Christopher Nolan’], [‘The Departed’, ‘Martin Scorsese’]] 2012:      [‘Argo’, ‘Ben Affleck’] 2007:      [‘Into the Wild’, ‘Sean Penn’] 2010:      [“The King’s Speech”, ‘Tom Hooper’] 2005:      [‘Munich’, ‘Steven Spielberg’] 2008:      [‘The Dark Knight’, ‘Christopher Nolan’] 2009:      [‘Mary and Max’, ‘Sam Elliot’] 2011:      [[‘The Artist’, ‘Michel Hazanavicius’], [‘The Help’, ‘Tate Taylor’]] 2015:      [‘Spotlight’, ‘Tom McCarthy’]   [‘Birdman’, ‘Alejandro G.Inarritu’] Choose and option:
Expected output Enter a year between 2005 and 2016: Birdman, Alejandro G. Inarritu   MENU Sort by: y- Year d-Director t – Movie title q- Quit   Choosean option: 2005:      Munich, Steven Spielberg   2006:      The Prestige, Christopher Nolan      The Departed, Martin Scorsese   2007:      Into the Wild, Sean Penn   2008:      The Dark Knight, Christopher Nolan   2009:      Mary and Max, Adam Elliot   2010:      The King’s Speech, Tom Hooper   2011:      The Artist, Michel Hazanavicius      The Help, Tate Taylor   2012:      Argo, Ben Affleck   2013:      12 Years a Slave, Steve McQueen   2014:      Birdman, Alejandro G. Inarritu   2015:      Spotlight, Tom McCarthy   2016:      The BFG, Steven Spielberg   MENU Sortby: y- Year d – Director t – Movie title q – Quit   Choose an option:

6. Compare output

0/3

Input 2008 d q
Your output Enter a year between 2005 and 2016:  [‘The Dark Knight’, ‘Christopher Nolan’] Choose andoption:Sam Elliot:      Mary and Max SteveMcQueen:      12 YearsaSlave Steven Spielberg:      Munich Steven Spielberg:      TheBFG Christopher Nolan:      The Dark Knight [‘The Departed’, ‘Martin Scorsese’]:      [‘The Prestige’, ‘ChristopherNolan’] TomMcCarthy:      Spotlight TomHooper:      The King’s Speech Ben Affleck:      Argo [‘The Help’, ‘Tate Taylor’]:      [‘The Artist’, ‘Michel Hazanavicius’] SeanPenn:      Into the Wild Alejandro G. Inarritu:      Birdman   [‘TheDarkKnight’, ‘ChristopherNolan’] Choose and option:
Expected output Enter a year between 2005 and 2016: The Dark Knight, Christopher Nolan   MENU Sort by: y – Year d – Director t – Movie title q – Quit   Choose an option: Adam Elliot:      Mary and Max,2009   AlejandroG.Inarritu:      Birdman, 2014   Ben Affleck:      Argo,2012   Christopher Nolan:      The Prestige, 2006      The Dark Knight, 2008   Martin Scorsese:      The Departed, 2006   MichelHazanavicius:      TheArtist, 2011   SeanPenn:      Into the Wild,2007   Steve McQueen:      12 Years a Slave, 2013   Steven Spielberg:      Munich, 2005      The BFG, 2016   Tate Taylor:      The Help,2011   TomHooper:      The King’s Speech, 2010   TomMcCarthy:      Spotlight, 2015   MENU Sortby: y- Year d- Director t – Movie title q – Quit   Choose an option:

7. Compare output

0/2

Input 2012 t q
Your output Enter a year between 2005 and 2016:  [‘Argo’, ‘Ben Affleck’] Chooseand option:Munich:      StevenSpielberg The King’sSpeech:      TomHooper IntotheWild:      SeanPenn Spotlight:      TomMcCarthy Birdman:      Alejandro G. Inarritu Mary and Max:      Sam Elliot Argo:      Ben Affleck [‘ThePrestige’, ‘ChristopherNolan’]:      [‘The Departed’, ‘Martin Scorsese’] The Dark Knight:      Christopher Nolan The BFG:      Steven Spielberg [‘The Artist’, ‘Michel Hazanavicius’]:      [‘The Help’, ‘Tate Taylor’] 12YearsaSlave:      SteveMcQueen   [‘Argo’,’BenAffleck’] Choose and option:
Expected output Enter a year between 2005 and 2016: Argo, Ben Affleck   MENU Sort by: y – Year d – Director t – Movie title q – Quit   Choose an option: 12YearsaSlave:      SteveMcQueen, 2013   Argo:      BenAffleck, 2012   Birdman:      Alejandro G. Inarritu, 2014   Into the Wild:      Sean Penn, 2007   Mary and Max:      Adam Elliot, 2009   Munich:      Steven Spielberg, 2005   Spotlight:      TomMcCarthy, 2015   The Artist:      MichelHazanavicius, 2011   The BFG:      Steven Spielberg, 2016   The Dark Knight:      Christopher Nolan, 2008   The Departed:      Martin Scorsese, 2006   The Help:      Tate Taylor, 2011   The King’s Speech:      TomHooper,2010   ThePrestige:      ChristopherNolan, 2006   MENU Sortby: y – Year d – Director t- Movie title q – Quit   Choose an option:
 
Looking for a Similar Assignment? Order now and Get 10% Discount! Use Coupon Code "Newclient"

Parsing strings (Python 3)

6.6 Warm up: Parsing strings (Python 3)

(1) Prompt the user for a string that contains two strings separated by a comma. (1 pt)

  • Examples of strings that can be accepted:
    • Jill, Allen
    • Jill , Allen
    • Jill,Allen 

Ex:

Enter input string: Jill, Allen


(2) Report an error if the input string does not contain a comma. Continue to prompt until a valid string is entered. Note: If the input contains a comma, then assume that the input also contains two strings. (2 pts) 

Ex:

Enter input string: Jill Allen

Error: No comma in string.

Enter input string: Jill, Allen


(3) Using string splitting, extract the two words from the input string and then remove any spaces. Output the two words. (2 pts) 

Ex:

Enter input string: Jill, Allen

First word: Jill

Second word: Allen


(4) Using a loop, extend the program to handle multiple lines of input. Continue until the user enters q to quit. (2 pts) 

Ex:

Enter input string: Jill, Allen

First word: Jill

Second word: Allen

Enter input string: Golden , Monkey

First word: Golden

Second word: Monkey

Enter input string: Washington,DC

First word: Washington

Second word: DC

Enter input string: q

 
Looking for a Similar Assignment? Order now and Get 10% Discount! Use Coupon Code "Newclient"