Skip to content

Latest commit

 

History

History
32 lines (17 loc) · 591 Bytes

File metadata and controls

32 lines (17 loc) · 591 Bytes

Reading from the keyboard

Next, we will connect the keyboard to our program.

Warming up

What happens when you write the follwing lines in the IPython shell:

In  [1]: a = input()
In  [2]: a

Exercise 1

Which input statements are correct?

  • a = input()
  • a = input("enter a number")
  • a = input(enter your name)
  • a = input(3)

The Challenge: Enter a baby name

Write a program that asks for a name and an age, then writes a sentence with the entered data:

Bobby is 3 years old.

Extra challenge:

  • Add 1 to the age entered.