This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
#string with commas | |
millions = '25,000,000' | |
#convert to integer | |
intMillions = int(millions.replace(',','')) | |
print (intMillions) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
#decimal value | |
intValue = 2019 | |
print(intValue) | |
#type of the value | |
print(type(intValue)) | |
#convert to string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# hexadecimal value | |
number1 = '32' | |
# decimal value during conversion | |
print(int(number1)) | |
# considering as hexadecimal value during conversion |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
#Assign string value to the variable | |
myText = '2019' | |
print(type(myText)) | |
#convert String to Integer | |
intValue = int(myText) | |
#integer value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
#Assign string value to the variable | |
myText = '2019' | |
print(type(myText)) | |
#convert String to Integer | |
intValue = int(myText) | |
#integer value |