Posts

Showing posts from May, 2022

Making a calculator through function in Python

Image
  So we are going to discuss function through the calculator example.  #Calculator in python using function def addition():   print("Enter the first number\n")   a=int(input())   print("Enter the second number\n")   b=int(input())   print("\nThe sum of two number:",a+b) def Substranction():   print("Enter the first number\n")   a=int(input())   print("Enter the second number\n")   b=int(input())   print("\n The Substranction of two numbers",a-b) def multiplication():   print("Enter the first number\n")   a=int(input())   print("Enter the second number\n")   b=int(input())   print("\n The multiplication of two numbers",a*b) def division():   print("Enter the first number\n")   a=int(input())   print("Enter the second number\n")   b=int(input())   print("\n The division is:",a/b) addition() Output:-    

Making a guess the number GAME (First game in python)

  HELLO EVERYONE ..! FINALLY I AM GOING TO MAKE MY FIRST GAME IN PYTHON THAT GAME NAME IS "GUESS THE NUMBER".  YOU CAN ALSO PLAY UISNG SOURCE CODE GIVEN BELOW: #GUESS THE NUMBER GAME IN PYTHON n = 18 number_of_guesses = 1 print ( "Number of guesses is limited to only 9 times: " ) while (number_of_guesses <= 9 ): guess_number = int ( input ( "Guess the number : \n " )) if guess_number < 18 : print ( "you enter less number please input greater number. \n " ) elif guess_number > 18 : print ( "you enter greater number please input smaller number. \n " ) else : print ( "you won \n " ) print (number_of_guesses, "no.of guesses he took to finish." ) break print ( 9 - number_of_guesses, "no. of guesses left" ) number_of_guesses = number_of_guesses + 1 if (number_of_guesses > 9 ): print ( "Game Over" )

Making a unique Faulty Calculator (Special program) in Python

Image
  SO I AM GOING TO MAKE A FAULTY CALCULATOR BY THE HELP OF IF-ELSE STATEMENTS. IT WILL CALCULATE ALL  THE THING CORRECTLY EXCEPT SOME OF THEM. """FAULTY CALCULATOR --: I am going to make a calculator which do all calculations correct except 45+3(it will return 555),56*9(it will return 77) and 56/6( it will return 4).""" print ( "Enter the first number \n " ) num1= int ( input ()) print ( "Enter an operator \n " ) op= input () print ( "Enter the second number \n " ) num2 = int ( input ()) if op== '+' : if num1== 45 and num2== 3 : print ( 555 ) else : print ( "The sum is:" ,num1+num2) elif op== '*' : if num1== 56 and num2== 9 : print ( 77 ) else : print ( "The product is:" ,num1*num2) elif op== '/' : if num1== 56 and num2== 6 : print ( 4 ) else : print ( "The division is :" ,num1/num2)

Making the voting eligibility checker

Image
SO IN THIS BLOG WE ARE GOING TO MAKE A PROGRAM OF VOTING ELIGIBILTY CHECKER  JUST  LIKE  OUR PREVIOUS DRIVING ELIGIBILITY CHECKER BY THE HELP OF IF-ELSE CONTROL STATEMENT. # Voting eligibility checker print ( "Enter your age" ) age = int ( input ()) if age>= 18 : print ( "You are eligible for voting" ) else : print ( "You are not eligible...!" )

Making age eligiblity checker with If-else condition statement in Python

Image
 SO NOW WE ARE GOING TO LEARN IF ELSE CONDITIONS IN PYTHON LANGAUAGE . WE WILL MAKE A SIMPLE AND USEFUL PROGRAM TO CHECK ELIGIBILITY . # Driving eligibility checker print ( "Enter your age" ) age = int ( input ()) # Typecasting string into integer and taking input of users age if age> 18 and age< 101 : # if this condition is true then it will execute the print . print ( "You Can drive" ) elif age> 7 and age< 18 : #elif this condition is true then it will execute the print . print ( "You cannot drive" ) elif age== 18 : print ( "Come for physical fitness test" ) else : print ( "Enter a valid age..!" ) """So this was a very simple but useful tool for checking eligibility for driving"""

Making a dictionary like oxford dictionary in python

Image
 This is the blog in which i have written a piece of code to make a dictionary like oxford dictionary.  It will give you an idea that how we can use dictionary in python. NOTE--:  I will discuss the features and functionality of the dictionary in the next blog post. # Dictinary in python like oxford dictinary d1 = { "programming" : "the process or activity of writing computer programs" , "coding" : "the process of assigning a code to something for classification or identification" , "inheritance" : "inheritance is one of the most important feature of Object Oriented Programming Sub Class The class that inherits properties from another class is called Sub class or Derived Class" , "polymorphism" : "In C++, polymorphism refers to the fact that the same entity (object or function) behaves differently in different situations." , "encapsulation" : "In general, encapsulation

String slicing and other importants functions

Image
  SO today i am going to explain about string slicing and other important functions of the string with the help of a basic program. # String slicing and other function of python mystr = "i love coding" # creating a string print (mystr) # printing the particular string print (mystr[ 5 ]) # accessing 5th position of index of string ( we count the index from zero ) print (mystr[ 0 : 6 ]) # slicing the string ( starting from zero which is including but 6 is excluding) """Now i am going to write the code for the fuctions to perform some specific actions on the string. you can simply understand this code by running on your device compiler""" print ( len (mystr)) # this len() function is used to find the length of the string. print ( type (mystr)) # this type() function is used to find the data type . print (mystr.isalnum()) # this isalnum() function is used to detect that if the string is alpha numeric or not . print (mystr.endswith( "coding"

calculator in python for addition of two numbers

Image
  So This is a piece of code for calculator in python language ( For addition of two numbers) # calculator to add two numbers in python print ( "Enter the first number \n " ) num1 = input () # Taking first number input print ( " \n " ) print ( "Enter the second number \n " ) num2 = input () # Taking second number input print ( " \n " ) print ( "The sum is \n " ) print ( int (num1)+ int (num2)) # Printing sum of two numbers
Image
  WELCOME TO CodeWithRavin    HERE YOU'LL GET PRECIOUS AND MY OWN HANDTYPED   CODES .    AND I AM DAMN SURE THAT IT IS GOING TO HELP YOU IN ANY WAY. I AM STARTING FROM PYTHON LANGUAGE. SPECIAL DIALOGUE -- >> ""PEOPLE GET READY TO PROGRESS.....! UKHAD UKHAD KE DHER LAGA DENG ""