# Math πrate and Sam have been given a problem statement.
# Print all the numbers between 1 to 100 except multiples of 5 using for loops?
# Are you ready to help them?


''' Task 1: To continue or not '''
print("***** Task 1: *****")
print()
# Write a program using the for loop to print all the numbers between 1 to 100, except the multiple of 5 [Hint: Use the for loop]

i=1
for i in range(1,100):
    if i%5 == 0:
        continue
    print(i)


# Analyze the code, and understand what exactly happens

''' Task 2: Anti-Break '''
print("***** Task 2: *****")
print()
# Write a Python program that prints all the numbers from 0 to 6 except 3 and 6.

for i in range(7):
    if i == 3 or i == 6:
        continue
    print(i)

''' Task 3: Harmonic Series '''
print("***** Task 3: *****")
print()
# Math πrate and Sam have been able to ace each and every quest.
# The final one is to create a Harmonic number series.  
# Harmonic numbers are described by the formula: (sum of inverses of natural numbers):
# Hn=Hn-1 +1/n
# Harmonic series are used in the field of mathematics as well as physics. For example, if you wanted to know how many record-breaking rainfalls have taken place over a period of  time, then one would use the Harmonic series.
# Write a program to display the n terms of harmonic series and their sum. The series is : 1 + 1/2 + 1/3 + 1/4 + 1/5 ... 1/n terms

n = int(input())
total = 0
for i in range(1, n + 1):
    print(f"1/{i}", end=" + " if i < n else "\n")
    total += 1 / i
print("Sum:", total)



''' Task 4: Start the timer '''
print("***** Task 4: *****")
print()
# You are going to the museum with your friends. 
# You start from home at 10.00 am. 
# You are really excited and can’t wait to get there. 
# You have set a "Talking Timer" that will keep prompting on your location, after every 10 minutes. 
# You need to write a program that:
# Takes the time to reach the destination as input
# Calculates the number of times the timer will prompt
# At the time when you should have reached, the "Talking Timer", checks if you found a parking space. 
# If yes, it stops the prompt
# [Hint: Keep the time in minutes]
time_needed = int(input("Enter the time needed (in minutes): "))

prompts = time_needed // 10

for i in range(prompts):
    print("Talking Timer: Where are you?")

parking_found = input("Have you found a parking space? (yes/no): ")

if parking_found == "yes":
    print("Talking Timer stopped.")
else:
    print("Talking Timer: Keep looking for parking.")


'''Awesome! You have really mastered when to use the break and continue keyword in the loops. Way to go!!'''

Embed on website

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