Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/python
#assign employee Id to list1
empId = ['1', '2', '3', '4']
#assign employee name to list2
empName = ['Tom', 'Maddy', 'Sam', 'John']
#assign employee age to list3
empAge = ['29', '30', '28', '32']
#zip the values
#!/usr/bin/python
#assign employee name to list
empName = ['Tom', 'Maddy', 'Sam', 'John']
#zip the values
emp = zip(empName)
#Prints the values in zip
print('\nValues in zip')
#!/usr/bin/python
#assign employee Id to list1 of size 5
empId = ['1', '2', '3', '4', '5']
#assign employee name to list2 of size 4
empName = ['Tom', 'Maddy', 'Sam', 'John']
#assign employee age to list3 of size 6
empAge = [29, 30, 28, 32 ,33 , 34]
#!/usr/bin/python
#assign employee Id to list1
empId = ['1', '2', '3', '4']
#assign employee name to list2
empName = ['Tom', 'Maddy', 'Sam', 'John']
#assign employee age to list3
empAge = ['29', '30', '28', '32']
#zip the values
#!/usr/bin/python
#no argument is passed in zip
list1 = zip()
#prints an empty zip
print(list1)
#type of the zip
print('type : ', type(list1))
#!/usr/bin/python
#string with commas
millions = '25,000,000'
#convert to integer
intMillions = int(millions.replace(',',''))
print (intMillions)
#!/usr/bin/python
#decimal value
intValue = 2019
print(intValue)
#type of the value
print(type(intValue))
#convert to string
#!/usr/bin/python
# hexadecimal value
number1 = '32'
# decimal value during conversion
print(int(number1))
# considering as hexadecimal value during conversion
@goyalrohit
goyalrohit / type3.py
Last active September 22, 2019 03:10
#!/usr/bin/python
#Assign string value to the variable
myText = '2019'
print(type(myText))
#convert String to Integer
intValue = int(myText)
#integer value
@goyalrohit
goyalrohit / type2.py
Last active September 22, 2019 04:32
#!/usr/bin/python
#Assign string value to the variable
myText = '2019'
print(type(myText))
#convert String to Integer
intValue = int(myText)
#integer value