PYTHON ASSIGNMENT
1. James Deen is an investor specializing in the Technology Domain. James purchases stock in successful
technology companies using a stockbroker and later sells them at a profit margin.
As part of his investment portfolio, James purchased 2000 units of stock in Google LLC worth 80,000(40
apiece) in the month of November, 2019. The stockbroker charged 3% commission on the total purchase
value of the stocks.
A month later, James sells his entire stock holding in Google LLC for $42.75 apiece. He pays a commission of
3% on this transaction as well to his stockbroker.
Write a Python program that returns the following output:
The cost of purchasing the entire stock holding in Google LLC
The amount of money paid in commission during the purchase
The selling price of the entire stock holding in Google LLC
The amount of money paid in commission during the sale
The profit margin made by James in the entire transaction (purchase & sale, including commissions paid)
2.Try to find out the hidden sentence using Slicing. The solution consists of 2 steps!
#Python courses in Toronto by Bodenseo'
#Toronto is the largest City in Canada'
s = "TPoyrtohnotno ciosu rtshees lianr gTeosrto nCtiot yb yi nB oCdaennasdeao"
3. . Write a Python program to build a numeric converter. The program will take integer from the user and
convert it into binary, octal , hexadecimal, float , complex format.
SAMPLE INPUT AND OUTPUT:
Enter a number 123
The binary of the number is 0b1111011
The octal of the number is 0o173
The hexadecimal of the number is 0x7b
The float of the numbers is 123.0
The complex of the number is 123+0j)
4.Swap 2 Variables Without a Temporary Variable:
x = 10
y=5
# Swap x and y without using a temporary variable
5.Find common elements between two lists
list1 = [1, 2, 3, 4]
list2 = [3, 4, 5, 6]