Tuesday, July 22, 2025

WTP in python - Traffic Light Simulator

 # Traffic Light Simulator

# Input a color (red, yellow, green) and print the corresponding action:


# Red → Stop

# Yellow → Get Ready

# Green → Go


light_type=input("Please enter the light type (red, yellow, green ) : ")



if(light_type=="red"):

    print("Stop")

elif(light_type=="yellow"):

    print("Get Ready")

elif(light_type=="green"):

    print("Go")

else:

    print("wrong input")

WTP in python - Login System

 # Login System

# Ask for a username and password. 

# If both match predefined values, print "Login successful", else show appropriate error messages.

#username : abc

#password : 123



user=input("Please enter username: ")

password= input("Please enter the password:  ")


if(user=="abc" and password == "123"):

    print("Login successful")

elif(user != "abc" and password != "123"):

    print("both Incorrect Username and Password ")

elif (user != "abc"):

    print("Username is not correct ")

else:

    print("password is incorrect ")

WTP in python - Vowel or Consonant

# Vowel or Consonant

# Input a single alphabet and check whether it is a vowel or consonant.


letter=input("Please enter the letter: ")


if (letter == "a" or letter == "e" or letter == "i" or letter == "o" or letter == "u"):

    print(f"{letter} is vowel ") 

else:

    print(f"{letter} is consonant" )

 

WTP in python - Simple Calculator

 # Simple Calculator

# Ask the user to input two numbers and an operator (+, -, *, /) and perform the corresponding operation.


num1=float(input("Please enter the first number : "))

operator= input("Please enter (+,-,/,* ) : ")

num2=float(input("Please enter the second number :"))




if (operator=="+"):

    result=num1+num2

    print(f"{num1} + {num2} = {result}")


elif (operator=="-"):

    result=num1-num2

    print(f"{num1} - {num2} = {result}")


elif (operator=="/"):

    result=num1/num2

    print(f"{num1} / {num2} = {result}")


elif (operator=="*"):

    result=num1*num2

    print(f"{num1} * {num2} = {result}")


else:

    print("function not exsites as of now ")


WTP in python : Input three numbers and print the largest one

# Number Comparison

# Input three numbers and print the largest one.


# Logic Recap:

# First, check if num1 is greater than or equal to both num2 and num3.

# If not, check if num2 is greater than or equal to both num1 and num3.

# If neither is true, then num3 must be the largest.



num1=int(input("Please enter the first number: "))

num2=int(input("Please enter the second number: "))

num3=int(input("Please enter the third number: "))



if(num1 >= num2 and num1 >=num3):

    print(f"{num1} is the largest")

elif(num2>=num1 and num2 >=num3):

    print(f"{num2} is largest ")

else:

    print(f"{num3} is largest ") 

WTP in python - Leap Year Checker

# Leap Year Rules Recap:

# A year is a leap year if:

# It is divisible by 4 and not divisible by 100

# OR

# It is divisible by 400

# For example:


# 2000 → Leap year ✅ (divisible by 400)

# 1900 → Not a leap year ❌ (divisible by 100 but not 400)

# 2024 → Leap year ✅ (divisible by 4 and not 100)

#take input from user 

year = int(input("Please enter the year:  "))

if (year % 4 ==0 and year % 100 !=0) or (year % 400 == 0):

    print(f"{year} is a leap year")

else:

    print(f"{year} is not a leap year")


WTP in python - Grade Calculator


# Grade Calculator

# Input a percentage and print the grade:


# A (90–100)

# B (80–89)

# C (70–79)

# D (60–69)

# F (below 60)


percent=int(input("Please enter the percent: "))


if (percent>=90 and percent<=100):

    print(f"{percent} , Your Grade is A")

elif(percent>=80 and percent<=89):

    print(f"{percent} , Your Grade is B")

elif(percent>=70 and percent<=79):

    print(f"{percent} , Your Grade is C")

elif(percent>=60 and percent<=69):

    print(f"{percent} , Your Grade is D")

elif ( percent >0 and percent<60):

    print(f"{percent} , Your Grade is F")

else:

    print("Invalid Number") 

WTP in python - Age Group Classifier

Age Group Classifier

Input a person's age and classify them as:


Child (0–12)

Teen (13–19)

Adult (20–59)

Senior (60+)



#take the input from user


age=float(input("Please enter you Age:  "))


if(age>0 and age<=12):

    print(f"{age} , Child")

elif(age>=13 and age<=19):

    print(f"{age} ,Teen ")

elif(age>=20 and age<=59):

    print(f"{age} , Adult")

elif(age>=60):

    print(f"{age} , Senior ")

else:

    print(f"{age} , Invaild Age ")

WTP in python - check the number is Even or Odd

 

Write a program that takes an integer input and checks whether it is even or odd.


num=int(input("Please Enter the Number : "))


num_check = num % 2


if (num_check == 0):

    print(f"{num} even number")

else:

    print("odd number ")

WTP in python - check Positive, Negative, or Zero

 

Ask the user to enter a number and print whether it is positive, negative, or zero.


# Positive, Negative, or Zero Checker

#take the input from user 

number=float(input("Please enter the number : "))


# check the condition 

if (number>0):

    print(f" {number} is postive")

elif(number<0):

    print(f"{number} is negative")

else:

    print(f"{number} is zero")

Friday, July 18, 2025

How to print in python ?

print ("Hello world ")

Download python

To download the python for various platform like Windows, Linux , MacOS 


https://www.python.org/downloads/

Python Introduction

What is python ?

  • Python is very popular programming language  and this is developed by Guido van  Rossum .

  • This is released in 1991 .

  • Python supports multiple programming paradigms, including procedural, object-oriented, and functional programming

Key characteristics
  • Interpreted: Python code is executed line by line, simplifying debugging and allowing for rapid prototyping.
  • Object-Oriented: It supports object-oriented programming, enabling developers to create reusable and modular code.
  • Dynamically Typed: Python automatically determines variable types during runtime, reducing the need for explicit type declarations and making coding more flexible.
  • High-Level: Python handles complex operations like memory management, allowing developers to focus on problem-solving rather than low-level details.
  • Platform Independent: Python code can run on various operating systems (Windows, MacOS, Linux) without modification, promoting portability.
  • Free and Open-Source: Python is freely available to download, use, and distribute, fostering a large and active community that contributes to its continuous development and extensive library ecosystem. 
Good to know :

The most recent version is python3 


Python Bootcamp -: Zero to Hero

Index :

Introduction :