Skip to main content

Posts

Showing posts with the label Python

Intro to Python Programming - 3. Basic Input

Hi guys,           Firstly I would like to thank you all for the giving us the wonderful response for our previous posts! Thank you very much for that. It means a lot to us. :) :D                      In my earlier post, I had blogged about Basic Output in Python programming language. I hope you have now understood the concept of printing data onto the standard output device using the print( ) statement.           In this post, we shall learn how the Python program receives input from the user or standard input device. Once again, as I had mentioned in the earlier post, please be careful regarding the version of python you are using.           If you are using Python version 2.7, the input function to be used is: raw_input( ) Whereas, if you’re using Python 3.5, then the input function to be used i...

Intro to Python Programming - 2. Basic Output

Hello everyone!           Considering the lot of requests I received from my dear friends and viewers, I shall now start posting step by step tutorials for mastering Python programming. I proceed with the assumption that you have a basic foundation of the C programming language . If not much of it, at least having some idea about the type specifiers such as ‘%d for integer, %f for floating point variables etc.’ and also, some basic ideas about data types such as int , float , char etc. would be of great help. :)           Before we begin with the coding part of python, I want you to understand a few basic concepts, like: 1.      Python is scripting language. 2.      Python programs do not make use of statement terminators like semicolons ‘;’ as in C, C++ and Java. 3.      A basic Python program does not require any header ...

A simple Calculator Using Python

Hello viewers, Today I am gonna show you a simple code to help you make a calculator using Python programming language. There are a number of ways of doing this.The man idea behind this code is to teach you how to write functions in Python. The syntax goes like this Syntax def functionname ( parameters ): "function_docstring" function_suite return [ expression ] By default, parameters have a positional behavior and you need to inform them in the same order that they were defined. Example The following function takes a string as input parameter and prints it on standard screen. def printme ( str ): "This prints a passed string into this function" print str return The calculator code here: ''' Program make a simple calculator that can add, subtract, multiply and divide using functions ''' # define functions def add ( x , y ): """This function adds two numbers""...

An Alcoholic Python Program! My friends' first step in Python programming XD

Hi folks,              Today my dear friends Akshay and Chetan have taken their first step towards learning the Python programming language. This is the program they have written after learning the language for the whole day.              Let us appreciate their interest towards learning Python.                           They sure have a fun way of learning things. I hope you like the program! Thank you!         :) #Basic input operation day = raw_input ( "What is the day today?? \n " ) #list declarations weekday = [ 'monday' , 'tuesday' , 'wednesday' , 'thursday' , 'friday' ] weekend = [ 'saturday' , 'sunday' ] #Implementation of if statements if day in weekday:     ...