trying new Python features in the IDLE shell.
>>> input('hello?')
>>> name = input('Enter your name: ')
>>> name
>>> int('371')
>>> int('three')
>>> text = input('Enter a number: ')
>>> text
>>> text + 1
>>> int(text)
>>> int(text) + 1
>>> n = int(input('Enter a number: '))
>>> n
>>> z = 47
>>> 'z represents {z}'
>>> f'z represents {z}'
>>> print(f'one more than {z} is {z+1}')
>>> year = 2022
>>> phrase = 'cool beans'
>>> 'The year is ' + str(year) + ' and the phrase is \'' + phrase + '\'.'
>>> f'The {year=} and {phrase=}.'
>>> break
>>> while True:
s = input('? ')
if s == 'q':
break
print('keep going')
>>> None
>>> None is None
>>> None is not None
>>> weird = None
>>> weird is None
>>> n = None
>>> type(n)
>>> n > 34
>>> n is None or n > 34
>>> def sq(x): return x * x
>>> sq(5)
>>> type(sq)
>>> g = sq
>>> g(7)
>>> def twice(f, y): return f(f(y))
>>> twice(sq, 3)
From IDLE, Open the file lab5_examples.py
in a folder
with `simple_graphics.py’. Read over
the file in detail. Bring questions to ask at the start of lab.
Run the module in IDLE and then experiment with using each of the functions in the IDLE shell, as in:
>>> greet('Mike')
>>> string_repl()
>>> repl_sum()
>>> top_down_guessing_game()
>>> has_any('C3P0', is_digit)
>>> draw_map_repl()