import random
def roll_two_dice():
a = random.randint(1,6)
b = random.randint(1,6)
return a+b
def guess_letter():
letters = 'abcdefghijklmnopqrstuvwxyz'
return letters[random.randint(0,len(letters)-1)]
Question answers:
- A can be printed and concatenated as a standard string, B can be appended and store different string lengths in each element, and C can only be read from.
- Languages have different variable types because different variables' contents are incompatible by nature. "A" + 32 + True - (1,2,3) = ????
- Technically speaking, everything COULD be represented as integers since computers store everything as 1s and 0s anyways, but using integers to store a string would be incredibly difficult and inefficient.
No comments:
Post a Comment