Skip to main content

1. Python If-Else (HackerRank problem with solution)

Python If-Else (HackerRank problem with solution)

Problem-1




Solution:-(using Python 3)

if __name__ == '__main__':
    '''if __name__ == '__main__': is a universal condition which is
    used to run program as by default in built-in system value of
     __name__ = '__main__' it can be checked by print(__name__) code'''

    n = int(input().strip())
    #using .strip() is s good practice for removing blank spaces

    if (n%2==0 and (n in range(2,6) or n>20) and (n in range(0,101))):
        print("Not Weird")

    elif (n%2==0 and n in range(6,21) and (n in range(0,101))):
        print("Weird")

    elif (n in range(1,101)):
        print("Weird")

    else:
        print("Number is out of range")

Comments

Popular posts from this blog

Basic knowledge of cars which everyone should have.

Let’s drive towards the automobiles industry. A.    Well-known car manufacturing companies with their country of origin. ·       Mercedes, AUDI, BMW, Volkswagen, Porsche - Germany ·       TATA, Mahindra, Maruti -India ·       Suzuki, Isuzu, Honda, Toyota, Nissan, Mitsubishi, Datsun – Japan ·       Ford, Chevrolet - America ·       Hyundai, Kia - South Korea ·       MG Motors - China ·         Landrover, Jaguar, Mini – England   B.    Types of cars ·       Hatchback ·       Sedan ·       SUV (Sport Utility Vehicle) ·       Coupe ·       Limousine ·       ATV (All Terrain Vehicle) ·     ...

Lessons learned from a bicycle.

M y Bicycle tales 🚲 I vividly remember my first cycling experience on a Hero 'Cyclone' bike, a sky blue colored that belonged to my elder sister. As a child, riding that cycle felt like a privilege, but due to my height, it wasn't the perfect fit for me. My parents always reassured me that once I grew taller, my sister would lend it to me. I longed for the day when I could ride that cycle. Finally, in 7th grade, my patience paid off. My sister offered me the Cyclone bicycle. The feeling of joy I experienced that day is indescribable. For two months, I felt like a prince, seizing every opportunity to go outdoors with my bicycle. Whether it was fetching groceries, to buy milk, or helping my dad with bringing hardware accessories from nearby store, I was always ready for a ride, exploring the streets near my home. But one unfortunate day, tragedy struck. Returning home from my tuition classes, my  Cyclone bicycle was nowhere to be found. Panic set in, and I rushed to a nearby...

How to know behavior patterns of the buyer like their basic needs, influences and motives?

 How to learn making customer strategy through case study. (PART -2) How to know the buyer behavior patterns like their basic needs, influences and motives? Maslow’s Hierarchy of Needs   1)    Social Needs:- Buyers are conscious towards numerous variables of chocolates like structure and size of the chocolate, its consistency in the mouth, contact, its softening and so forth. There are different elements like moral obligation of Hershey’s company and corporate social duty influences the buying choice of the chocolate customers. For instance corporate social duty of the organization incorporates lawful consistence, ecological issue and so on. In assembling the item organization ought to pursue the principles and controls made by the controllers of the business. Hershey dependably pursued the legitimate necessities of the chocolate manufacturing industry. Likewise the corporate social obligation of the organization impacts the buyers to consider the organization on...