HackerRank Day 2: Operators | Python

preview_player
Показать описание
In this series, I will walk you through Hacker Rank’s 30 days of code challenge day by day.

In Day 2, we learn to use operators.

Try solving it yourself!

View my solution for Day 2 at

Join our LinkedIn Group to ask questions and learn from others.

Support me on Patreon!

#OTSC #HackerRank #Python
Рекомендации по теме
Комментарии
Автор

I don’t believe that I racked my brain to solved an problem such simples how this, thanks bro

feliphealmeida
Автор

this is the right source of code for those who have intendation error
type this code in line 11


    print(round(total_cost)) "

raghavkrish
Автор

this is for people who got that annoying indentation error on the 'if' statement I found out the solution.
You will have to just get rid of this line of code: def solve(meal_cost, tip_percent, tax_percent):
and then its fixed!

suniro
Автор

You are saving me big time headaches brother, thank you, much appreciated you took the time to do this!

CoachGrimes
Автор

Thank you man, very greatly appreciated that you shared this information!

chrisdon
Автор

you can remove error by removing the complete code and then paste this








meal_cost = float(input())


tip_percent = int(input())

tax_percent = int(input())
z = meal_cost * tip_percent / 100
p = meal_cost * tax_percent / 100
totalCost = (round(meal_cost + z + p))
print(int(totalCost))

Valorant_player_collector
Автор

having errors even if my code is right, went through all the possibilities suggested in the comment section. Is there anything else

kazifaiad
Автор

What is the use of str in print statement anyway without explicitly specifying strong it will give the output in integer only right?

ravigiri_
Автор

It shows an intendation error while I code of the line of ..if ...
statement

Growth__Hub_
Автор

str is not working and it's not giving the right answer in the 3rd test case

WatchMe_
Автор

Can you please guide the video using java programming

AmitGupta-lxze
Автор

im having an error which is that in my output there is no space between 15 and dollars can somebody help me

vasukaushik
Автор

HackerRank starting python3 code looks like this:

# Complete the solve function below.
def solve(meal_cost, tip_percent, tax_percent):

tip_amount = meal_cost * tip_percent / 100
tax_amount = meal_cost * tax_percent / 100
total_cost = round(meal_cost + tip_amount + tax_amount)
print (total_cost)



if __name__ == '__main__':
meal_cost = float(input())
tip_percent = int(input())
tax_percent = int(input())
solve(meal_cost, tip_percent, tax_percent)

wong
Автор

Even if i use your code it gives out no response

Tompaa
Автор

iam getting error anybody please help me

abveekshith