Python Forum
Help with loop & user input
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with loop & user input
#6
hey thanks for reply........
I am from finance background, regardless

I am learning coding as hobby.
So you guys are my teachers in someway. So, yes we all can agree as this being homework.
now assuming that this is homework, can any one give me idea as how to proceed??

do i need a list or dictionary or variable & or define a function?

What i had done?

print('How many cars do you have? ')
user_input = input()

if user_input == int:
    pass
else:
    print('Please input number only. ')

def hmCars(howManyCars):
    for x in user_input:
        if user_input <= 0:
            break
        else:
            for x in user_input
how i can loop through user_input ?

ok '0' is not an integer. So i don't need the break statement.
Reply


Messages In This Thread
Help with loop & user input - by rdDrp - Dec-19-2016, 05:50 PM
RE: Help with loop & user input - by micseydel - Dec-19-2016, 05:57 PM
RE: Help with loop & user input - by rdDrp - Dec-19-2016, 06:22 PM
RE: Help with loop & user input - by nilamo - Dec-19-2016, 10:41 PM
RE: Help with loop & user input - by metulburr - Dec-20-2016, 04:29 AM
RE: Help with loop & user input - by rdDrp - Dec-23-2016, 04:04 AM
RE: Help with loop & user input - by Larz60+ - Dec-23-2016, 04:20 AM
RE: Help with loop & user input - by wavic - Dec-23-2016, 05:25 AM
RE: Help with loop & user input - by rdDrp - Dec-23-2016, 04:36 AM
RE: Help with loop & user input - by Larz60+ - Dec-23-2016, 04:37 AM
RE: Help with loop & user input - by snippsat - Dec-23-2016, 05:27 AM
RE: Help with loop & user input - by rdDrp - Dec-23-2016, 06:10 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
Question I need help for my python homework (getting the user input into a .txt file) Haydengjy 5 1,280 Mar-25-2025, 08:31 PM
Last Post: deanhystad
Exclamation How to get program to loop if input date is in the past? xander_thornton45 3 1,910 Oct-11-2024, 10:08 AM
Last Post: Pedroski55
Question Simulate an answer based on user input [Beginner needs guidance] Bombardini 1 2,023 Nov-12-2022, 03:47 AM
Last Post: deanhystad
  Print user input into triangle djtjhokie 1 3,229 Nov-07-2020, 07:01 PM
Last Post: buran
  Changing Directory based on user input paulmerton4pope 13 12,884 Aug-14-2020, 11:48 AM
Last Post: GOTO10
  how to add the user input from file into list wilson20 8 6,014 May-03-2020, 10:52 PM
Last Post: Larz60+
  Adding string numbers, while loop and exit without input. Jose 11 11,434 Apr-15-2020, 08:34 AM
Last Post: Jose
  Writing a function that changes its answer based on user input SirRavenclaw 2 3,743 Dec-21-2019, 09:46 PM
Last Post: Clunk_Head
  Print the longest str from user input edwdas 5 5,690 Nov-04-2019, 02:02 PM
Last Post: perfringo
  Question about running comparisons through loop from input value Sunioj 2 3,265 Oct-15-2019, 03:15 PM
Last Post: jefsummers

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020