0% found this document useful (0 votes)
11 views

Basics of Python Programming

Python

Uploaded by

Hemant Ntl
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

Basics of Python Programming

Python

Uploaded by

Hemant Ntl
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Basics of Python Programming

Structure of a python program:

Python Character Set:- A set of valid characters recognized by python. Python


uses the traditional ASCII character set.
 The latest version recognizes the Unicode character set.
 The ASCII character set is a subset of the Unicode character set.
 Letters :– A-Z,a-z
 Digits :– 0-9
 Special symbols :– Special symbol available over keyboard (@,#,%,&)
 White spaces:– blank space,tab,carriage return,new line, form feed
Other characters:- Unicode

Input and Output:


var1=‘Computer Science'
var2=‘Informatics Practices'
print(var1,' and ',var2,' )

Output :- Computer Science and Informatics Practices raw_input() Function


In Python allows a user to give input to a program from a keyboard but in the
form of string.

NOTE : raw_input() function is deprecated in python 3


Example-
age = int(raw_input(‘enter your age’))
percentage = float(raw_input(‘enter percentage’))
input() Function In Python allows a user to give input to a program from a keyboard
but returns the value accordingly.

Example-
age = int(input(‘enter your age’)) C = age+2 #will not produce any error
Indentation:-
Indentation refers to the spaces applied at the beginning of a code line. In other
programming languages the indentation in code is for readability only, where as the
indentation in Python is very important.
Python uses indentation to indicate a block of code or used in block of codes.
Example(1)-
if 3 > 2:
print(“Three is greater than two!") //syntax error due to not indented
Example(2)-
if 3 > 2:
print(“Three is greater than two!") //indented so no error

Tokens

Tokens

In a passage of text, individual words and punctuation marks are


called tokens or lexical units or lexical elements. The smallest
individual unit in a program is known as a Token or a lexical unit.

1. Keywords 2. Identifiers 3. Literals 4. Operators 5. Punctuators/Delimiters

You might also like