Featured
- Get link
- X
- Other Apps
Creating a python program
To create a python program:
Lets start with a simple program. It is traditional in programming to start with "hello world" program
Open your default python editor that is your IDLE
Create a new file type
Print("hello world")
Save it as sample.py
Now click on run module or f5
Output: hello world
This how you create a program in python
Variable and Datatype:
Variable is nothing but a alphabet which holds the data . There are different types of data type like int, float, string, Boolean, list, tuples, dictionary
1. Int- int is integer nothing but a whole number
2. Float- it is a floating point numbers
3. String-nothing but a text, string is always enclosed by quotation marks
4. List, tubles and dictionary are called sequence we will see that in future post
Creating variables:
Creating variables in python is very simple, we just choose a name and assign a value
mynumber = 10
mytext = "hello"
Now we have defined our variable, we can start to use them. For example we could print the value
Print(mytext)
Output: 10
Hello
To make it more clear
Value=10
Number= int(value)
Because sometimes int values that is numbers can be taken as string so we can use like it
In next post lets see about the operators in python
- Get link
- X
- Other Apps
Comments
Post a Comment