name = input("What is your name?: ") age = int(input("How old are you?: ")) height = float(input("How tall are you?: ")) print("Hello "+name) print("You are "+str(age)+" years old") print("You are "+str(height)+"cm tall")
#take the user's name as input name = input("Enter your name: ") print(name) #the vaiable that includes the welcome message is alredy provided. #Please complete this part using the knowledge obtained in this lesson. greeting = #print the welcome message print(greeting) Please help to solve this problem
I'm taking a python course and input function was briefly explained at this point. I tried coding it myself and was getting a syntax error. You solved my problem. Thank you!
Thanks for the in depth video explaining casting for different data type. I am new to Python and this video helped me understand the basics very quickly. Great explanation.
- Write a loop that asks the user to input an integer between 10 and 60. If they enter something that is not an integer in that range, ask them again, giving an error message to remind them. Once they enter an integer, create a loop that keeps dividing the number by two, taking its integer value, and printing the result until it reaches zero. For example, entering 55 would produce: 55, 27, 13, 6, 3, 1 Run the code, first entering a value outside the range 10 - 60. Then run the code again with a valid value. • Make sure your output shows the results of both runs
Thanks bro your vids are the best they really helped me a lot in last minutes. I'm writing a test now at 2:00 and I wasn't really that focused during my lectures, I just discovered you now and you really helped, THANK YOU!!
Awesome!! I don't see many American use Celsius. And now you also use centimeters. Oh!! and the video is as great as always. I almost all your Java tutorials. Right now, I just start your Python and JavaScript together!! All are great!!!!!
I have issues understanding the logic of using input function and how it used followed by print. Trying to understand it by this video..Its a great video so far @brocode👏👏👏👏👏👏
I started learning this program just a few days ago and run into you. Your videos are awesome. However, I have a question (not sure if this too early to talk about), but how would I limit user to enter only alphabet not some numbers for his name?
u can use the isalpha() function, if the entered string has anything but alphabets, the function would return a false value, so u can check if stringvalue.isalpha() == False, if yes, then there are string + numbers... Hope this helps
you can also use the TRY and EXCEPT function to check if it is a aphabet or not if it isnt it will tell the user to enter the alphabet and will keep repeating until it gets it right, u would have to use a while loop to do that.
as Fyuse said use try except but if the user typed a number insead of a name give them a massage saying something like "please retype your name correctly" or "only use letters" or whatever what you want the imput to be use if statement with isalpha() if you want no spaces
After taking user inputs, what are different ways to hide user prompts in python for eg: what is your name? , how old are you ? such text should not appear after getting inputs from user.
Is there a way to create a input funktion looking like this: "" , I tried it several times, but got to no solution. Idea: Name = print("< ") + input(" ").strip() + print(">")
Can the user input be an arithmetic operation? For example when you ask them "How old are you? " Can they enter 20+1 instead of 21? If not, how to fix that? Thanks.
Hey Bro! I have a project where it relies on the user inputting a number and I use this line of code A = float(input("Insert a number (it can be a decimal number)")) If the user inputs anything else other than numbers my whole code breaks. Can you help me?
This is what I got for the Mad Libs: Today I went to a abandoned zoo In an exhibit, I saw Tim Apple Tim Apple was Crazy and falling I was filing his taxes
Bro i have a question i hope you could help me So whenever i run any simple input code The IDE doesn’t accept user input so i can’t write down anything in the console when i run the code What should i do ?
What is the code if i want the user to find the position of a word in paragraph and this paragraph is in a variable like .. X= """ Bla bla bla bla , hello world """" Now i want the user to input to know the word " hello " what its position