Divyanshu
0
Q:

how to accept input from the user in python

# Python 3

txt = input("Type something to test this out: ")

# Note that in version 3, the print() function
# requires the use of parenthesis.
print("Is this what you just said? ", txt)
10
#basic user handling for begginers

x = input("your question here") # when someone types something here that answer will be saved and be used for later

# for example 
print(x)
8
var = input("Text: ")
7
# if you want to ask the user to input anything, use the keyword "input"

# example

a = input("What is your name") # the user will be prompted to answer the question 

print(a) # this allows the user to actaully see the question or anything
3
#Take Integer Value
nval=int(input("Enter a number : "))
#Take String Value
sval=input("Enter a string : ")
#Take float value
fval=float(input("Enter a floating-point number : "))
0

New to Communities?

Join the community