Atharva Warke
Type of 7: int
Type of 5.123: float
Result of int(8.99): 8
Value of x where x = 3 + 2 * 2: 7
Value of y where y = (3 + 2) * 2: 10
Value of z where z = x + y: 17
Result of 11 // 2: 5
Value of x after x=4 and x=x/2: 2.0
print(d[:3]) or print(d[0:3]) when d = “ABCDEFG”: ABC
Substring “Python” and “Fun” from s = “PythonIsFun”: “Python”: s[:6] “Fun”: s[9:]
print(e[::2]) where e = ‘clocrkr1e1c1t’: correct
var.upper() where var = “You are learning python”: “YOU ARE LEARNING PYTHON”
Operations on text t: Position of “slacker”: t.find(“slacker”) Replace “challenging” with “interesting”: t.replace(“challenging”, “interesting”)
Scientist[-3] where Scientist = “Marie Curie”: “i”
Output of print(“AB\nC\nDE”): AB C DE
“hello class”.find(“class”): 6
“data science”.find(“science”): 5
Length of courses_tuple: 6
Element at index 3: “Biology”
Indexes 3, 4, and 5 of courses_tuple: (“Biology”, “English”, “History”)
First two elements of courses_tuple: (“Mathematics”, “Physics”)
Managing datasets_list: Create list: datasets_list = [] Add datasets: datasets_list.extend([“Housing Prices”, “Credit Card Fraud”, “Customer Segmentation”, “Stock Prices”, “Healthcare Claims”]) Add “Social Media Sentiment”: datasets_list.append(“Social Media Sentiment”) First dataset: datasets_list[0] Last dataset added: datasets_list[-1] Full list: print(datasets_list) Finance-related datasets: [“Credit Card Fraud”, “Stock Prices”] Replace “Stock Prices” with “Cryptocurrency Prices”: datasets_list[datasets_list.index(“Stock Prices”)] = “Cryptocurrency Prices” Remove “Healthcare Claims”: datasets_list.remove(“Healthcare Claims”)
Keys of dictionary {“a”:1,“b”:2}: [“a”, “b”]
Dict[“D”] for Dict={“A”:1,“B”:“2”,“C”:[3,3,3],“D”:(4,4,4),‘E’:5,‘F’:6}: (4, 4, 4)
Textbooks dictionary management (textbooks_dict): Create dictionary: textbooks_dict = {} Add textbooks details and delete publicationYear as needed.
Convert list [‘mystery’, ‘science fiction’, ‘fantasy’, ‘non-fiction’, ‘mystery’] to set: {“mystery”, “science fiction”, “fantasy”, “non-fiction”}
Check if sum(A) == sum(B) where A = [1, 2, 2, 1] and B = set([1, 2, 2, 1]): False
Union of programming_set1 and programming_set2: {“Python”, “Java”, “C++”, “Ruby”, “JavaScript”}
Check if programming_set1 is a subset of programming_set2: False