Skip to main content

Learn Python

 

Python 


what is data type ?

 to declaring of a variable is called data type 
another words to declare the data what type of the data it is !

data types ?

Text Type:str
Numeric Types:intfloatcomplex
Sequence Types:listtuplerange
Mapping Type:dict
Set Types:setfrozenset
Boolean Type:bool
Binary Types:bytesbytearraymemoryview
None Type:NoneType

                                                  more


CODE FOR LIST SLICING:
------------
word=input('what is word?:')
print(word[1::2])
------
input: rhaajrui
output :HARI
---------------
where 1=index of word 
2= after second letter will be print at everytime

SECOND ONE 

word='rhaajrui'
print(word[1::2])

output:hari


CODE FOR REVERSING OF A STRING:
 ----------------
word=input('what is word?:')
print(word[::-1])
 
------
input: IRAH
output :HARI
---------------
CODE FOR  STRING FORMAT:
name='krishna'
age='18'
sex= 'male'

print(f'the age of {name} is {age} and he is {sex}')

OUTPUT:   the age of krishna is 18 and he is male

SECOND ONE 

 name='krishna'
age='18'
sex= 'male'
print(name ,age ,sex)
print(f'the age of {name} is {age} and he is {sex}')
print('the age of '+name+' is '+age+' and he is '+sex)

OUTPUT:
krishna 18 male
the age of krishna is 18 and he is male
the age of krishna is 18 and he is male
-------------------------



Comments

Popular posts from this blog

web design for tution center

SMART LEARN WEBSITE WORK SAMPLE FOR TUTION CENTER  HOME PAGE DESIGN:- TIME SCHEDULE FOR TEACHING:- SERVICES OFFERED:- ABOUT US PAGE :- CONTACT US PAGE :- DESIGNED & DEVELOPED BY HARIKRISHNA 

COMPILER DESIGN

  COMPILER DESIGN COMPILER DESIGN  TEXT BOOK : DOWNLOAD HERE COMPILER DESIGN  TEXT BOOK :  DOWNLOAD HERE