Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a Python program (with a main guard) that acts as a very basic circle area calculator. The program will repeatedly ask the user for
Write a Python program (with a main guard) that acts as a very basic circle area calculator. The program will repeatedly ask the user for an input radius and will output the area of the circle with that given radius. If the input radius is negative a message is given that the radius must be non- negative (and then ask for another radius). The program ends when the user enters 'quit' (or 'Quit' or 'QUIT' or ...). The program should recognize any case variation for 'quit' to exit the program. For example, your program might look like the following (highlighted is user input): Fancy Circle Area Calculator enter radius : 12 the area of that circle is 452.3893421169302 enter radius: 1.1 the area of that circle is 3.8013271108436504 enter radius : -1 the radius must be non-negative enter radius : quit Thanks for using the Fancy Circle Area Calculator Note: the area of a circle with radius r is given by x p2, were T is called pi and is approximately 3.145. Use the value of pi provided in the math module for your calculation. Do not hard-code the value yourself in your code. Write a Python program that does the following in this order): 1. displays to the screen your name (not user input, but your ACTUAL name) 2. displays to the screen your Carleton student ID number (your ACTUAL student ID; if you are a uo student user your uO ID) 3. displays to the screen your age (does not have to be real) 4. displays to the screen X number signs (hash tag symbols, #) on a single line, where X is your age. Your code should NOT contain more than one number sign (#) in it though. For example, if you are 7 years old then you should not hard-code '#######' in your code. 5. Repeats the above four steps using user input (that your program asks for). 6. Prints to the screen who is older (you or the user) or if you are the same age. For example, the output might look like the following: (user input looks like this ) name: Cat Kittenish id: 900123456 age: 27 ######## ######## enter your name: Dog Mutts enter your id: 800999999 enter your age: 4 name: Dog Mutts id: 800999999 age: 4 #### Cat Kittenish is older than Dog Mutts Write a Python function called more() that takes three string inputs and outputs a string. Formally, the function signature and output are given by more(chari: str, char2: str, word: str) -> str Use the same names for the input parameters as shown above. Note that char1 and char2 will always be a string of length 1 (i.e., it is a single character). The function checks which of char1 or char2 appears more often in the word string and returns that character. If both characters appear the same number of times (once or more times) then the function returns the concatenation of char1 and char2. If neither characters are in the word string the function returns the empty string. For example, print( 'there is more', more('a', 'b', 'cattab') ) print( 'there is more', more('A', 'a', 'dog') ) print( 'there is more', more('a', 'b', 'bagab') ) will display there is more a there is more there is more ab
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