reate a simple program for landlocked surfers who just want to see some waves

Programming with Python
Homework II: Loops
Submission: FirstNameLastNameHomework2.py file

Start your script with the comment #FirstName LastName Homework2 and save the file as FirstNameLastNameHomework2.py. This file should contain parts A, B, C, and D.

Get Your Custom Essay Written From Scratch
Are You Overwhelmed With Writing Assignments?
Give yourself a break and turn to our top writers. They’ll follow all the requirements to compose a premium-quality piece for you.
Order Now

Part A – Waves
Create a simple program for landlocked surfers who just want to see some waves. The program should:
Create a variable equal to the string ‘v’
Ask how many ‘waves’ the user would like printed
Using a loop, concatenate as many v’s as necessary to the variable created in step 1
After the loop has completed, print the variable from step 1

Example (Part A):
How many waves would you like to ride?
>>20
Vvvvvvvvvvvvvvvvvvvv

 

 

Part B – Url List
Levain Bakery has an application that will scrape comments from Yelp. This application will only scrape one webpage at a time and Yelp currently has 360 pages of comments. Levain doesn’t necessarily want to scrape all 360 pages. Instead, they want an application that will ask the user how many pages she/he wants to scrape.
You might notice that the url for each page is the same except a number at the end. For each page, the number is equal to the page number minus 1 multiplied by 20.
For example, the url for page 2 is:
https://www.yelp.com/biz/levain-bakery-new-york?start=20
And the url for page 3 is:
https://www.yelp.com/biz/levain-bakery-new-york?start=40
Using this information, you need to create a list of all url’s the user would like to scrape. Each url will be a string datatype.
To do this, you need to:
Start with this list:
[‘https://www.yelp.com/biz/levain-bakery-new-york’]
Note:
This is the first page that needs scraping
Ask the user how many pages she/he would like to scrape
Using a loop:
Use an equation to determine the appropriate number and add it to this string:
https://www.yelp.com/biz/levain-bakery-new-york?start=
Add the result to the list created in step 1
After the loop has completed, print the complete list. The length of this list should be equal to the number of pages the user wanted to scrape.

Example (Part B):
How many pages would you like to scrape?
>>4
[‘https://www.yelp.com/biz/levain-bakery-new-york’, ‘https://www.yelp.com/biz/levain-bakery-new-york?start=20’, ‘https://www.yelp.com/biz/levain-bakery-new-york?start=40’, ‘https://www.yelp.com/biz/levain-bakery-new-york?start=60’]

Part C – Mean Bargain
A user would like to purchase a product you are selling. However, each time the user makes an offer below the price for which you’re willing to sell, you get mad, and increase the price by 1 dollar.
This script should:
Create a price variable equal to any number between 1 and 20;
Ask the user how much she/he is willing to pay;
If the amount from step 2 is less than the amount from step 1:
Increase the price by 1;
Tell the user you’re unwilling to sell for the amount offered and ask for another amount;
Repeat step 3 until the user enters a price greater than or equal to the price;
Print ‘It’s a deal! The price is [price]’, like ‘It’s a deal! The price is 22’.
Extra Challenge (not required):
Can you inform the user how much she/he overpaid? This number should be the price paid minus your original asking price (before the price increases).
s
Part C Example (Original price = 15):
How much will you pay?
>>11
Nope! Try offering more:
>>15
Nope! Try offering more:
>>17
It’s a deal! The price is 17

Part C Extra Challenge Example:
[After output from example above]
You overpaid by 2. I was originally willing to sell for 15.

 

Part D – Password
Create a password verification process. The script should:
Select a password and save it to a variable (should not be a password you actually use)
Ask the user to make a password attempt
If the password is not correct, enter a loop to allow the user 2 more attempts:
Inform the user that the attempt is incorrect and ask the user to try again
If the new attempt is correct or the user has tried 3 times total, the loop should end
End the script by informing the user if access is granted or not
Extra challenge (not required for credit):
Can you also inform the user of how many attempts are left?

Part D Example 1:
Please enter the password:
>>Sojourner
That is incorrect, please try again:
>>Beauvoir
Access granted

Part D Example 2 (Access denied):
Please enter the password:
>>Soujourner
That is incorrect, please try again:
>>Anthony
That is incorrect, please try again:
>>Wollstonecraft
Access denied

Part D Example 3 (Extra challenge):
Please enter the password:
>>Soujourner
That is incorrect, please try again (2 attempts left):
>>Beauvoir
Access granted