Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Solution

  • Create a program that allows the user to enter a word/phrase, and outputs the first letter of that word/phrase
word = input()
print(word[0])
  • Create a list with one string of your choice in it
  • Then prompt the user to enter a number, and add that number to the list. Then add the result of multiplying your number by 2 to the list. Then print the list
    • Ex. [“Apple”, 10, 20]
    • [“Mousepad”, 13, 26]
list = ["Cargo"]
number = int(input()) # change this

list.append(number)
list.append(2 * number)
print(list)

Contributors: