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 PYTHON

 Guess A Number Game In Python

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 python . 

Lets start coding

Import random

First import random module to generate random number by the computer .we have to write import random.

After import random we have to generate random number .For this we have to write computerguess=random.randint(1,100).


Taking user input 

For taking user input we have to write userguess=int(input("Enter your guess number:\n"))

NOTE-taking user input in while loop.

Game condition 

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

when user input is equal to number generated by the computer then display Your guess is right You guess number in i Times .here i is number of times user take to guess number generated by computer.

when user input is lower then generated number then display your guess is low.

when user input is higher then generated number then display your guess is high.

when user input input other keyword then display Please enter valid guess.

HERE ARE THE CODE




OUTPUT