Skip to main content

How to make calculator in python kivy

  How make calculator in python We make a calculator in python using kivy module . Kivy module helps us to make android apps . First wait , If you run a kivy program in your terminal then you see a error like this To solve this problem you have to go kivy docs and follow the instruction of kivy docs.  First we have to make a virtual environment and then in the virtual environment you have to install kivy . After that you have to write  kivy_venv\Scripts\activate in your terminal and then run the file . If this method not work then write the comment below. LETS START CODING First we import kivy .For this we hve to write  from  kivy.app  import  App from  kivy.uix.label  import  Label from  kivy.uix.button  import  Button from  kivy.core.window  import  Window from  kivy.uix.gridlayout  import  GridLayout from  kivy.uix.widget  import  Widget from  kivy.lang  import ...

HOW TO MAKE GUESS A NUMBER GAME IN JAVA

 Guess A Number Game In Java

Guess a number game is a game in which a random number is generated by the computer and we have to guess the number. 

we write a computer program with the help of java . 

Lets start coding

Import java.util.Random

First import random module to generate random number by the computer .we have to write import java.util.Random;

After import random we have to generate random number .For this we have to write Random r=new Random();

     int computerguess=r.nextInt(100);

Taking user input 

For taking user input we have to import java.util.Scanner .So, we have to write

import java.util.Scanner;


For taking user input we have to write System.out.println("Enter your guess number:");

            Scanner sc=new Scanner(System.in);

            int userguess=sc.nextInt();

NOTE-taking user input in while loop.


Game condition 

for the game condition we have to use if ,else if condition .

when user input is equal to number generated by the computer then display you guess right number in "numberoftimes" Times

 .Here numberoftimes is number of times user take to guess number generated by computer.

when user input is lower then generated number then display Its too low.

when user input is higher then generated number then display Its too high.

when user input input other keyword then display Guess a number in between 0 to 100.


HERE ARE THE CODE




OUTPUT