-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconversions.py
More file actions
27 lines (20 loc) · 785 Bytes
/
Copy pathconversions.py
File metadata and controls
27 lines (20 loc) · 785 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
x=13.8
print("integer x =",int(x)); #converts into integer
x=13000
#print("Long x =",long(x));
#x=13
print("Floating point of x =",float(x)); #converts into float
real,img=8,9;
print("Complex number is ",complex(real,img)); #converts into complex
x=1
print("String conversion of ",x,"is",str(x)); #converts into string
x=1
print("String expression of ",x,"is",repr(x)); #converts into expression
a=190
s='a'
print("Conversion of",a,"to character is ",chr(a)) #converts into character
a=190;
#print("Conversion of",a,"to unicode character is ",unichr(a))
print("Conversion of",s,"to integer is ",ord(s)) #converts into integer
print("Conversion of",a,"to hexadecimal is ",hex(a)) #converts into hexadecimal
print("Conversion of",a,"to octal is ",oct(a)) #converts into octal