# You have been using variables and data types to solve the different problem statements.
# Imagine if you did not have to worry about some of the operations, and it got done by the snap of a finger.
# Well!! Python can definitely help you. 
# Want to know more about it? Let's get started.
'''Task 1: Absolutely or not'''
print("***** Task 1: ***** ")
print()
# StudMonkey lives on the apple tree 
# He now want to live on the banana tree which is across the river
# The actual distance to the Banana tree is 58 km but others told him that it is 93 km.
# Help StudMonkey, to calculate the  extra kilometers he has been told by others. Ready to help?

# Uncomment the statements below and click Run
distance_from_origin = 58                    
distance_travelled = 93                      
distance_to_go = distance_from_origin - distance_travelled
print(distance_to_go)
print(abs(distance_to_go))

# Is there a difference?
# abs() is a built-in function that returns the absolute value of a number. 
# With a negative number, abs() will return a positive number as absolute values are always positive numbers or zero.
# Now  write a program that takes a positive or negative number as the input  and displays it as a positive number.
inp = int(input("Please enter your friends height relative to  sea-level:"))
inp2 = int(input("Please enter your height relative to sea-level:"))
def dif():
    return inp - inp2
print("Your difference in sea level is", abs(dif()))
'''Task 2: What's the total?'''
print("***** Task 2: ***** ")
print()
# Imagine you have been given the task of calculating the sum of all the even numbers in the range of 0 to10.
# Can you write a program for the same?
# Your program might have been on the similar line:

tot=0
for i in range(0,11,2):
 tot=tot+i
print(tot) 
# Uncomment the statement and see how it works::
tot=sum(range(0,11,2))
print(tot)

# The way sum works is: sum(iterable, start)
#  - where iterable can be a list of numbers or a range of numbers.
#  - start is an optional parameter start, that will be added to the final sum. Since it is optional, if you do not specify it is taken as 0.
# In our example, we have taken a range of even numbers and calculated the total.
# Can you tweak the program to print the total of odd numbers in the range of 0 to 10?
add = sum(range(1,10,2))
print(add)
'''Task 3: Fast and Furious'''
print("***** Task 3: ***** ")
print()
# Studmonkey has to swing by 10 trees spaced 2 kms apart to reach the palm tree.
# His speed is 0.5 km/min. How long will it take him to reach the palm tree?
# [Hint: time=distance/speed]
time = (10*2)/0.5
print(f"It will take {time} minutes to reach the palm tree.")

'''Task 4: Maximum or Minimum'''
print("***** Task 4: ***** ")
print()
# After a test, would you like to know who scored the highest or
# Tabulate the best and worst performance of a cricketer
# Python has two inbuilt functions that will help you find the answer within seconds.
# Uncomment the statements below and click Run

#print("Check this out!!")
#x=56
#y=90
#z=78
#p=max(x,y,z)
#s=min(x,y,z)
#print(p)
#print(s)
#print("Here is another one!!")
#x="A"
#y="G"
#z="U"
#p=max(x,y,z)
#s=min(x,y,z)
#print(p)
#print(s)

# What did you observe? 
# You will notice that two functions have been used:
#  - max(list of values): It returns the largest value from the list of values 
#  - min(list of values): It returns the smallest value from the list of values
# Uncomment the statement below and observe the result:

#grades = "AABABBACBAABCD"
#print(max(grades))

# What exactly happened?

'''Task 5: What's your score'''
print("***** Task 5: ***** ")
print()
# Write a program that takes the following input from five students:
# - Grade/Class
# - Scores in the following subjects - Mathematics, Science and English
# Your program then needs to display the highest score for that student

'''Task 6: Divisible or Not'''
print("***** Task 6: ***** ")
print()
# Do you remember the operators you would use to find the remainder and quotient of a division operation? 
# Using the divmod() function you can find both through a single operation. Here is how you would do it:
# Uncomment the statements below, run them and analyze the oupt you get:

#print(divmod(8,3))
#print(divmod(11,4))
#print(divmod(10,2.5))
#print(divmod(52.2,12))

'''Task 7: Trees in a Row'''
print("***** Task 7: ***** ")
print()
# StudMonkey again needs your help. He wants to plant 80 more trees near his new house, the BananaTree. 
# But he is unable to decide, help him by giving options  of how he should plant the new 80 trees that each row will have an equal number of trees.


'''Task 8: Quick Questions'''
print("***** Task 8: ***** ")
print()
# StudMonkey is really happy with your help and now has some questions for you:
# Question 1: If I have to calculate 3 to the power 3 how will I do?
# Answer: We have to use pow () built-in function here. 
#         pow(x,y) : Computes x to the power of y. 
#         For example: pow(3, 2) will return 9.

# Question 2: The value of π is big, 3.14159,I want to print the value of the π till 2 decimal numbers. How can I do it?
# Answer: We have to use round() built-in function here.
#         round(number, digits): Will round up the number to decimal point specified by digits.
#         For example: round(3.14159,2) will return 3.14

# Uncomment the statements below and observe the result   
#print(pow(3,2))
#print(round(3.14159,2))

'''Task 9: Let's go for lunch'''
print("***** Task 9: ***** ")
print()
# StudMonkey is feeling hungry, he takes his friends for lunch
# They decided to split the bill amount of INR 187.93 into two equal parts. The tip money which is 20% of the bill amount is added to the total amount.
# Can you write a program to help calculate the total bill amount and how much each needs to pay.


'''Great! You are getting really good with working with built-in functions.'''

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: