ZTM Training

Run Settings
LanguagePython
Language Version
Run Command
# selfish='me myself I' # selfish = selfish + ' alone' # print(selfish) # quote = 'to be or not to be' # print(quote.upper()) # print(quote.capitalize()) # print(quote.lower()) # print(quote.find('be')) # print(quote.replace('be', 'you')) # birth_year=input('What year were you born?\n') # age=2025-int(birth_year) # print(f'Your age is {age} years old') # username=input('What is your username? \n') # password=input('What is your password? \n') # password_lenght=len(password) # hidden_password= '*' * password_lenght # print(f'Hello {username}, your password, {hidden_password}, is {password_lenght} letters long.') # new_list = ['a', 'b', 'c'] # print(new_list[1]) # print(new_list[-2]) # print(new_list[1:3]) # new_list[0] = 'z' # print(new_list) # my_list = [1,2,3] # bonus = my_list + [5] # my_list[0] = 'z' # print(my_list) # print(bonus) # basket = ["Banana", ["Apples", ["Oranges"], "Blueberries"]]; # print(basket[1][1][0]) # basket=[1,2,3,4,5] # new_list=basket.append (100) # print(basket) # print(new_list) #Does NOT produce any value # basket.extend([101,102]) # new_list=basket.extend([101,102]) # print(basket) # print(new_list) #Does NOT produce any value # basket.pop() # basket.pop(0) # new_list=basket.pop(5) # print(basket) # print(new_list) #will produce the value of the pop # basket.remove(5) # print(basket) # # print(new_list) #Does NOT produce any value # basket.clear() # print(basket) # # print(new_list) #Does NOT produce any value #Exercice # basket = ["Banana", "Apples", "Oranges", "Blueberries"] # # 1. Remove the Banana from the list # # 2. Remove "Blueberries" from the list. # # 3. Put "Kiwi" at the end of the list. # # 4. Add "Apples" at the beginning of the list # # 5. Count how many apples in the basket # # 6. empty the basket # basket.remove("Banana") # basket.remove("Blueberries") # basket.append("Kiwi") # basket.insert(0,"Apples") # print(basket.count("Apples")) # basket.clear() # print(basket) ##Exercie #fix this code so that it prints a sorted list of all of our friends (alphabetical). Scroll to see answer # friends = ['Simon', 'Patty', 'Joy', 'Carrie', 'Amira', 'Chu'] # new_friend = ['Stanley'] # friends.extend(new_friend) # print(sorted(friends)) # a,b,c,*list2, d = [1,2,3,4,5,6,7,8,9] # print(list2) # Exercise Dictionary Methods # 1 Create a user profile for your new game. # This user profile will be stored in a dictionary with keys: 'age', 'username', 'weapons', 'is_active' and 'clan' # 2 iterate and print all the keys in the above user. # 3 Add a new weapon to your user # 4 Add a new key to include 'is_banned'. Set it to false # 5 Ban the user by setting the previous key to True # 6 create a new user2 my copying the previous user and update the age value and username value.
Editor Settings
Theme
Key bindings
Full width
Lines