#!/usr/bin/env python # coding: utf-8 # In[1]: 3+4 # In[2]: Weight=60 weight=78 print(Weight) print(weight) # In[3]: patient_id = '1' PATIENT_id= 1 print(type(patient_id)) print(type(PATIENT_id)) # In[4]: A=2.2 * Weight print(A) # In[5]: B=A+1 print(B) # In[6]: # Convert PATIENT_id to string before concatenation patient_id_number = 'inflam_' + str(PATIENT_id) print(patient_id_number) # In[ ]: c= 'ox1ge3' len(c) # In[ ]: #The data is not final. patient_id = '1' PATIENT_id= 1 print(type(patient_id)) print(type(PATIENT_id)) # In[ ]: element = 'oxygen' element[1:-1] # In[ ]: fruits=["apple", "banana", "cherry", "apple"] fruits[1] # In[7]: fruits = ("apple", "banana", "cherry", "apple") print(fruits) # In[ ]: print(fruits) # In[ ]: fruits.remove('pear') print(fruits) # In[ ]: fruits = ("apple", "banana", "cherry", "apple") fruits[1] # In[ ]: fruits[1]= 'pear' # In[8]: fruits_list = list(fruits) print(fruits_list) # In[16]: fruits_list.append('lettuce') print(fruits_list) # In[17]: fruits_list.append('dragonfruit') print(fruits_list) # In[9]: fruits = {"apple", "banana", "cherry", "apple"} print(fruits) # In[10]: fruits.add('pear') print(fruits) # In[ ]: # Option 1: Check if the item exists before removing fruits = ['apple', 'banana', 'orange'] # Example list, replace with your actual fruits list if 'cherry' in fruits: fruits.remove('cherry') else: print("'cherry' is not in the list") print(fruits) # Option 2: Use try-except to handle the error # fruits = ['apple', 'banana', 'orange'] # Example list # try: # fruits.remove('cherry') # except ValueError: # print("'cherry' is not in the list") # # print(fruits) # In[11]: fruits.remove('cherry') print(fruits) # In[12]: fruits.remove('apple') print(fruits) # In[13]: fruit_colors = { "apple": "red", "banana": "yellow", "cherry": "red"} print(fruit_colors) # In[14]: fruit_colors['apple'] # In[15]: fruit_colors['banana']='purple' print(fruit_colors) # In[ ]: