0

Inputs

I'm trying to learn how to use inputs in python, I'm not sure how to add an input though, does the input have to be writing input() or do I have to write something in the parenthesis. If I do need something in the parenthesis then is there a way to make an input I'm able to customize so I can put anything? For example name = input() idk how to put a name in there

9th Feb 2024, 6:13 PM
Cody
Cody - avatar
5 Respuestas
+ 1
If you want to creat a question befor asking input just write some thing in () Like if you write: input("ENTER YOUR NAME") The output will be ENYER YOUR NAME And after that you should enter input.
11th Feb 2024, 6:25 AM
Fateme Biglari
Fateme Biglari - avatar
0
input() # always gives you a string type num = int(input("give me a number!: ")) print(f"your number is {num}") # run this code # this will print a message: give me a number!: # and after entering a number, will print you a message and a number # try to enter a letter, you will face an error I hopy this helps you a little bit
9th Feb 2024, 7:04 PM
Mihaly Nyilas
Mihaly Nyilas - avatar
0
Cody , Don't put any prompt text in the input. Just do it like this. my_string = input() or my_int = int(input()) or my_float = float(input()) etc. 1. Prompt text is useless on Sololearn, because the code playground requires the user to enter all inputs before running the program, so the prompts won't be seen until it's too late. 2. Prompt text gets printed, so it's considered part of the output of your program in Code Coach test cases, and since the test cases don't expect it, they will fail.
9th Feb 2024, 7:22 PM
Rain
Rain - avatar
0
input() takes 0 arguments in the parentheses. By the way, input() always inputs an immutable string. ^
10th Feb 2024, 5:08 PM
MattMad
MattMad - avatar
0
That's true - but that doesn't input anything, it just output the stuff put in the parentheses. My bad.
11th Feb 2024, 8:10 AM
MattMad
MattMad - avatar