Category Archives: Learn python with example

summing_numbers_in_python

Python Example 2 – Summing Numbers

Hello World, Welcome to projectsplaza.com. In this tutorial, we will create a custom python function to show the sum of the provided numbers. This function takes a sequence of numbers and shows the sum of those numbers. This exercise helps you to understand numbers and function design.


Continue reading

number-guessing-game-in-python

Python Example 1 – Number guessing game with python

Hello World, Welcome to projectsplaza.com. Today we will discuss how to create a number guessing game with python. This tutorial is for python beginner. Python has three different numeric types: int, float, and complex. Most of the time, it is enough to know about int(for the whole number) and float(for fraction number). For this game, we will do the following steps

  • Write a function guess_number that takes no arguments.
  • When we run this function it will automatically choose the number between 0-50.
  • Ask the user to guess what number has been chosen.
  • Every time user guess a number, we will indicate the following:
    • Too High
    • Too Low
    • Just Right
  • If the user guesses the correct number then the program exit, otherwise the user is asked to try again.
  • Programm will exist only if the user guesses the correct number.

Continue reading