Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1. Write a program that assigns a string to the variable called phrase and then transforms phrase into a hashtag. In other words, all words
1. Write a program that assigns a string to the variable called phrase and then transforms phrase into a hashtag. In other words, all words in phrase are capitalized, all spaces are removed, and a # appears in front. Store the result in a variable called hashtag . Then print the value of both phrase and hashtag . Your program should start with phrase = 'Things you wish you knew as a freshman' and the output from the program (using print() function calls) should be The phrase "Things you wish you knew as a freshman" becomes the hashtag "#Things YouWishYouKnewASAFreshman" Note that the output includes the quotation marks. 2. One of the challenges of programming is that there are often many ways to solve even the simplest problem. Consider computing the area of the circle with the standard formula a(r) = ar Fortunately, we now have pi from the math module, but to compute the square of the radius we now can use ** or pow() or we can just multiply the radius times itself. To print the area accurate to only a few decimal places we can now use the string format() method or the round() built-in function, which includes an optional second argument to specify the number of decimal places. Write a short Python program that computes and prints the areas of two circles, one with radius 5 and the other with radius 32. Your code must use ** once and pow() once and it must use format() once and round() once. The output should be exactly Area 1 = 78.54 Area 2 = 3216.99
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started