Computer Science LearnITWithMrC ⛯ Year 7 Year 8 Year 9 GCSE
0 results for
ICT
Responsive image

Lesson 2 - Coding in Python

0 results forGuest
Overview
Flight Path
Learning Objectives
0 results forGuest
IDSkill_name
 4 I can get user input from the keyboard and output it to the screen

🏁 Learning Objective 4 :- I can get user input from the keyboard and output it to the screen


User Input

In python if you want the user to input data into the program, you can use the input()function, this is another built in functions to help us put data into our program.

Let us now look at the the input method input().

Input Cheat sheet

Flight Path

Challenges - x <- USERINPUT


  • 1

    Getting a user's input.
    Complete the challenge below

...In order to get user input in python you need to use the input() function. This puts a prompt onto the screen to allow the user to enter data. If you want to use the data in your program you have to store it in a variable . The print function can then use the variable to output our user input to the screen .

x = input(" ")

  • 2

    More input.
    Complete the challenge below

  • 3

    Display address details.
    Complete the challenge below

  • 4

    Using Numbers.
    Complete the challenge below

...If we want to use numbers in our code we have to change the user input to the data type of the number we want to use.

For example if the type of number we want to use is a whole number then we convert the input using the int() function.

However if the type of number we want to use was a decimal number then we convert the input using the float() function.

x = int(input(" "))

  • 5

    Converting Numbers.
    Complete the challenge below

  • 6

    Some maths
    Complete the challenge below

  • 7

    Extension Challenge
    Complete the extension challenge below

Update your objectives

control


0 results forGuest
Recent Comments

Teacher Date: 2021-09-29


Guest