answersLogoWhite

0

I get in put with input() function like this:

x = input("what do you want to ask")

User Avatar

Wiki User

10y ago

What else can I help you with?

Continue Learning about Engineering

How input and output is achived in python programming?

in python 3 basic input and output are achieved withstring = input("prompt>")andprint("something")In python 2 you havestring = raw_input("prompt>")andprint "something"


What is the purpose of print strings in python?

It means that python will print(or write out) a value you input.


What is the meaning of print and input in idle python?

"print" will output a value onto the screen for a user to see. "input" or "raw_input" gets a user's input.


How do you write the code by python?

it depends what type of program you wish to write. python is a very simple programing langauge therefore it doesnt have much room to play with. i mainly use it to work out simple math problems, or use it to calculate thing for games i play, Ex.) This is a program i wrote to work out the Pythagorean therom to find side "C": a = input("Enter Corner Side A\n ") b = input("Enter Corner Side B\n ") c = a*a+b*b import math print math.sqrt(c) raw_input("Press <enter> To Leave Program") input mean that's where you enter your variable, raw input is what you put at the end so it doesnt just run away (NOTE*** THIS IS A PYTHON 2.6.5 SCRIPT, IT WILL NOT WORK ON OTHER VERSIONS OF PYTHON" notice i put ("Press <enter> To Leave Program") this is what it will say before it "runs away". i suggest watching some youtube videos on how to write programs for your version of python. also try using the manual that comes with your version of python. it helps greatly.


How do I convert a string to an integer in python?

1.>>> x=input("enter data: ")2.enter data: 253.>>> type(x)4.5.>>> y = int(x)6.>>> type(y)7.I used Python 3.0 for this.Else for earlier version, to accept string type input, u should be using "raw_input" instead of "input" only.I made python accept a data and tested its type, which return to be a string (line 4).Then I usedint()to convert the string into a number, which, for testing purpose, I assigned the value to a variable y. (line 5)Testing the type of data that variable y stores, confirms that the string type was converted to an integer type.(line 7)

Related Questions

How input and output is achived in python programming?

in python 3 basic input and output are achieved withstring = input("prompt>")andprint("something")In python 2 you havestring = raw_input("prompt>")andprint "something"


What is the purpose of print strings in python?

It means that python will print(or write out) a value you input.


How do you get input from the user in python?

In Python, you can get input from the user using the built-in input() function. This function prompts the user for input and returns it as a string. For example, you can use user_input = input("Enter something: ") to display a message and capture the user's response. If you need the input in a different data type, you can convert it using functions like int() or float().


What is the meaning of print and input in idle python?

"print" will output a value onto the screen for a user to see. "input" or "raw_input" gets a user's input.


How do you enter integer in python?

In Python, you can enter an integer using the input() function, which captures user input as a string. To convert this string to an integer, you can use the int() function. For example: user_input = input("Enter an integer: ") integer_value = int(user_input) This will convert the input string to an integer, assuming the user enters a valid integer.


How do you write a program to input radius of a circle and calculate the area or circumferences of the cirlce?

In which computer language?


Write a line of code that asks the python user to input an integer greater than 0 and store this value in a variable and display its value?

integer = input("Please input an integer greater than 0: ") print(integer)


Computer programs perform what three steps?

1. Input is received. 2. Some process is performed on the input. 3. Output is produced. Source: Starting out with Python by: Tony Gaddis


What is the process for generating a numpy cartesian product in Python?

To generate a numpy cartesian product in Python, you can use the numpy.meshgrid() function. This function takes in multiple arrays and returns a meshgrid of all possible combinations of the input arrays.


How do you write the code by python?

it depends what type of program you wish to write. python is a very simple programing langauge therefore it doesnt have much room to play with. i mainly use it to work out simple math problems, or use it to calculate thing for games i play, Ex.) This is a program i wrote to work out the Pythagorean therom to find side "C": a = input("Enter Corner Side A\n ") b = input("Enter Corner Side B\n ") c = a*a+b*b import math print math.sqrt(c) raw_input("Press <enter> To Leave Program") input mean that's where you enter your variable, raw input is what you put at the end so it doesnt just run away (NOTE*** THIS IS A PYTHON 2.6.5 SCRIPT, IT WILL NOT WORK ON OTHER VERSIONS OF PYTHON" notice i put ("Press <enter> To Leave Program") this is what it will say before it "runs away". i suggest watching some youtube videos on how to write programs for your version of python. also try using the manual that comes with your version of python. it helps greatly.


How do you use Blender with Python?

There are several ways. First, Blender's user interface was written in Python, and most of the commands and menus are actually Python functions. Blender actually contains the Python interpreter, and uses it extensively. Go to the Scripting view, and you'll see an interactive console. The python version exposed is based on your Blender version, but you'll typically see Python 3.? for newer versions of Blender. You can interact with Python in command-line mode here as with any Python interpreter. The scripting view also contains a text editor optimized for Python coding. Turn on syntax highlighting and choose from the Templates menu to see a number of interesting Python scripts. Most of these scripts can be run directly to control Blender through the command interface. This allows you to build automated scenes through program code. Finally, you can use a Python script as a controller in the game engine. This accepts input from sensors and passes output to actuators. However, your code can manipulate input and output any way you want, turning the Blender game engine into a full-blown 3D game development toolkit.


How can I implement a Huffman code in Python?

To implement a Huffman code in Python, you can follow these steps: Create a frequency table of characters in the input text. Build a Huffman tree using the frequency table. Generate Huffman codes for each character in the tree. Encode the input text using the generated Huffman codes. Decode the encoded text back to the original text using the Huffman tree. You can find Python libraries and code examples online to help you implement these steps effectively.