in Python please.
You buy an international calling card to India. The calling card company has some special offers.
If you charge your card with $15 or $20, you don't get anything extra.
For a $35 charge, you get $6 of extra phone time.
For a $60 charge, you get $7 of extra phone time.
For a $120 charge, you get $15 of extra phone time.
Write a function that asks the user for the amount he/she wants on the card and returns the total charge that the user gets.
Note: Values other than those mentioned earlier are not allowed.
Include appropriate comments to make your code more readable.
Trending nowThis is a popular solution!
Step by stepSolved in 3 steps with 1 images
using the "logic:" gives me a syntax error can you help me figure out another way for that.
using the "logic:" gives me a syntax error can you help me figure out another way for that.
- Local variables are known only to the function in which they are declared. Local variables are invisible outside the function in which they are declared. Whether True or False 11. It is possible for any function to return numerous values. Any function type may return multiple values. That's true, right?arrow_forwardThe use ofcomputers in education is referred to as computer-assisted instruction (CAI). Write a program that will help an elementary school student learn multiplication. Use the rand function to produce two positive one-digit integers. These two rand generated integers must be pass to the function named “ResultChecking”. The function should then prompt the user with a question, such as How much is 6 times 7? The student then inputs the answer. Next, the program checks the student’s answer. If it’s correct, the function will return 1 or true if it is false the function will return 0 to false. In the main you must display the message "Very good!" if the answer is correct and ask another multiplication question. If the answer is wrong, display the message "No. Please try again." and let the student try the same question repeatedly until the student finally gets it right. The function “ResultChecking” should be called once when the application begins execution and each time the user…arrow_forwardUse Python for this Question: Write a function orderPizza that allows the user input to build a pizza. It then prints a thank you message, the cost of the pizza and then returns the Pizza that was built. >>> orderPizza() Welcome to Python Pizza! What size pizza would you like (S,M,L): M Type topping to add (or Enter to quit): mushroom Type topping to add (or Enter to quit): onion Type topping to add (or Enter to quit): garlic Type topping to add (or Enter to quit): Thanks for ordering! Your pizza costs $14.299999999999999 Pizza('M',{'mushroom', 'onion', 'garlic'}) >>> orderPizza() Welcome to Python Pizza! What size pizza would you like (S,M,L): L Type topping to add (or Enter to quit): calamari Type topping to add (or Enter to quit): garlic Type topping to add (or Enter to quit): Thanks for ordering! Your pizza costs $16.65 Pizza('L',{'garlic', 'calamari'}) >>> p=orderPizza() Welcome to Python Pizza! What size pizza would you like (S,M,L): S Type topping to…arrow_forward
- In python, write a function that receives three parameters: name, weight, and height. The default value for name is James. The function calculates the BMI and returns it. BMI is: weight/(height^2). Weight should be in kg and height should be in meters. For instance, if the weight is 60 kg and the height is 1.7 m, then the BMI should be 20.76. The function should print the name and BMI. The function should return 'BMI is greater than 22' if the MBI is greater than or equal to 22. Otherwise, the function should return 'BMI is less than 22'. Call the function and print its output.arrow_forwardCreate a function that takes one, two or more numbers as arguments and adds them together to get a new number. The function then repeatedly multiplies the digits of the new number by each other, yielding a new number, until the product is only 1 digit long. Return the final product. Examples sumDigProd (16, 28) 6 // 16 + 28 = 44 // 4 * 4 = 16 // 1 * 6 = 6 sumDigProd (0) sumDigProd (1, 2, 3, 4, 5, 6) -2arrow_forwardCould you help me create a python code for this question? Thanks.arrow_forward
- Code is in Pythonarrow_forwardJAVA CODE PLEASE Functions With Parameters and Return Values Quiz by CodeChum Admin Create a function named oppCase that receives one character input that is an alphabet. Return the opposite case of that character. In the main function, write a program that asks for a character input and assign it to a character variable. Call the oppCase function by passing in the character variable and assign the returned value to a variable. On the next line, print the value assigned to the variable. Input 1. One line containing a character Output Enter·a·character:·A aarrow_forwardPYTHON Question 3: Rain or Shine Part 1: Alfonso will only wear a jacket outside if it is below 60 degrees or it is raining. Write a function that takes in the current temperature and a boolean value telling if it is raining and it should return True if Alfonso will wear a jacket and False otherwise. Try solving this problem with a single line of code. def wears_jacket(temp, raining): """ >>> wears_jacket(90, False) False >>> wears_jacket(40, False) True >>> wears_jacket(100, True) True """ *** YOUR CODE HERE *** Note that it should either return True or False based on a single condition, whose truthiness value will also be either True or False. Part 2: Rewrite the above function with a lambda expression.arrow_forward
- python3 programarrow_forwardToll roads have different fees at different times of the day and on weekends. Write a function CalcToll() that has three arguments: the current hour of time (int), whether the time is morning (bool), and whether the day is a weekend (bool). The function returns the correct toll fee (double), based on the chart below. Weekday Tolls Before 7:00 am ($1.15) 7:00 am to 9:59 am ($2.95) 10:00 am to 2:59 pm ($1.90) 3:00 pm to 7:59 pm ($3.95) Starting 8:00 pm ($1.40) Weekend Tolls Before 7:00 am ($1.05) 7:00 am to 7:59 pm ($2.15) Starting 8:00 pm ($1.10) Ex: The function calls below, with the given arguments, will return the following toll fees: CalcToll(8, true, false) returns 2.95CalcToll(1, false, false) returns 1.90CalcToll(3, false, true) returns 2.15CalcToll(5, true, true) returns 1.05 need help with code in c++arrow_forwardIbra Bakery wants you to create a simple python program for calculating cashback offers on cakes for the customers on the occasion of their second anniversary. The program should start by reading customer_name, Number_of_cakes. Then you need to do the following Create a void function and a parameter that will display “Welcome to Ibra bakery <customer name>”. example: Welcome to Ibra bakery Mohammed Create a function with return value and with a parameter Number_of_cakes. then input cake_price of each cake. Then calculate Total_price as sum of all the cakes’ prices. Create a function that will accept Total_price as parameter then compute cashback based on a criterion that if Total_price is more than 10.0 omr, cashback will be 20% of Total_price otherwise no cashback. Display all the details as output. User-defined function (python)arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education