DEV Community

SheetsC
SheetsC

Posted on

Flatiron - Phase 3

In this rendition of blogs I will be going over something in python that was not utilized in our curriculum. Python has many capabilities and functionalities but one thing that i came across in my studies is that we have had the capability to integrate user inputs for specific functionalities in the code we write.
input()
is a function that will prompt the user to enter a desired value into the command line when running our code.
How it works:
When calling this function we must assign it to a variable
Name = input('What is your name? ')
I have seen the most examples that show the naming convention is to capitalizes the variable. When we run our code the it will be read top down, hit the input function, then stop and ask for the user to enter the asked prompt in our code. It is also a good idea to leave a single space before our question mark. Once the user enters their answer the code will finish reading and that variable is now useable in our code.
Image description
The function will take the typed in value and set it in a string, from there evaluate and use it however we see fit

Image description

Top comments (0)