000001 Lecture Notes - Standard Streams

6 views3 pages
20 Mar 2023
Department
Course
Professor

Document Summary

How to take input from user in python: sometimes a developer might want to take user input at some point in the program. To do this python provides an input() function. Syntax: input("prompt") where prompt is an optional string that is displayed on the string at the time of taking input. # taking input from the user name = input("enter your name: ") Will be converted to string before printed sep="separator" : (optional) specify how to separate the objects, if there is more than one. Default :" end="end": (optional) specify what to print at the end. Default : \n" file : (optional) an object with a write method. Default :sys. stdout flush : (optional) a boolean, specifying if the output is flushed (true) or buffered (false). # code for disabling the softspace feature print( h", e", l , l", "o") Example: python print output with custom sep and end parameter.

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents

Related Questions