We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
  • HackerRank Home

    HackerRank

  • |
  • Prepare
  • Certify
  • Compete
  • Hiring developers?
  1. Prepare
  2. Tutorials
  3. 30 Days of Code
  4. Day 2: Operators
  5. Discussions

Day 2: Operators

Problem
Submissions
Leaderboard
Discussions
Editorial
Tutorial

    You are viewing a single comment's thread. Return to all comments →

  • [deleted] 2 months ago+ 0 comments

    My attempt here; still not very comfortable with input calls, i.e, input.x, for all x (e.g. "strip" = x)-

    #!/bin/python3
    
    import math
    import os
    import random
    import re
    import sys
    
    #
    # Complete the 'solve' function below.
    #
    # The function accepts following parameters:
    #  1. DOUBLE meal_cost
    #  2. INTEGER tip_percent
    #  3. INTEGER tax_percent
    #
    
    def solve(meal_cost, tip_percent, tax_percent):
        # Write your code here
        int(meal_cost)
        int(tip_percent)
        int(tax_percent)
        bill = ( ((tip_percent * meal_cost)/100) + ((tax_percent * meal_cost)/100) + meal_cost )
        print (round(bill))
        return
    if __name__ == '__main__':
        
        meal_cost = float(input().strip())
    
        tip_percent = int(input().strip())
    
        tax_percent = int(input().strip())
    
        solve(meal_cost, tip_percent, tax_percent)
    
    0|
    Permalink
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy