3.2.1
Input and output (3.2.1) is a Class 10 Computer Science lesson for the Punjab boards. It walks through the idea in plain steps, then sets a short check, in English, Urdu or Roman Urdu.
Your guide: Miss HiraExplains computers with chai, cricket and your phone.
Chapter 1 of every subject is free. Unlock every chapter of this class with the full course.
Unlock full courseAlready paid? Sign in with the Google account you paid with.
input() shows a prompt, waits for the user to type and press Enter, and returns the text as a string: name = input("Enter your name: ").
print() displays one or more values: print("Hello, " + name + "!"). Commas print several values with spaces; + joins strings.
Because input() gives text, convert it before doing maths: int(input(...)) for whole numbers and float(input(...)) for decimals.
Step 1 / 1
input() shows a prompt, waits for the user to type and press Enter, and returns the text as a string: name = input("Enter your name: ").
print() displays one or more values: print("Hello, " + name + "!"). Commas print several values with spaces; + joins strings.
Because input() gives text, convert it before doing maths: int(input(...)) for whole numbers and float(input(...)) for decimals.
input() always returns a string; wrap it in int() or float() for numbers.
Found a mistake? Tell us the lesson and the line at exciting@boringeducation.com.
No ads. Tell us what to fix.