Python Forum
Help with loop & user input
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with loop & user input
#1
This is Not homework assignment. I am beginner to programing itself, just started with python.

What i want to achieve is this:
  • Ask a question to user.
  • Get answer to above from user (numbers only)
  • Based on above answer, create something:
    what it that something should be?
    • a list
    • a variable
    • a dictionary
  • When something is created, that something will be getting user input till it reaches the value given at the first input ( i.e. at step which is marked in bold)

Example:
  • A. How many cars, you have given on rent?
  • B. This is user input, which only should accept numbers.
    > Ans/Value Input by user : 5   
    [# So the user has given 5 cars on rent.]
  • C. Now I want the user to input rental income of each of those 5 cars.

    > incomeFromCarOne = 1200   
    > incomeFromCarTwo = 2450 etc...    
    > till incomeFromCarFive is reached. 
  • D. If user input value is nil/zero or blank, the script should stop.
    [# What i mean by that is, script should go to next line of code which is independent of above.]
I could post code but it's basically getting input from user at B and that's it, i can not get past the first input.


System Info:
1. Win 7
2. Python 3.5

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,261 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,898 Oct-11-2024, 10:08 AM
Last Post: Pedroski55
Question Simulate an answer based on user input [Beginner needs guidance] Bombardini 1 2,018 Nov-12-2022, 03:47 AM
Last Post: deanhystad
  Print user input into triangle djtjhokie 1 3,225 Nov-07-2020, 07:01 PM
Last Post: buran
  Changing Directory based on user input paulmerton4pope 13 12,865 Aug-14-2020, 11:48 AM
Last Post: GOTO10
  how to add the user input from file into list wilson20 8 6,007 May-03-2020, 10:52 PM
Last Post: Larz60+
  Adding string numbers, while loop and exit without input. Jose 11 11,425 Apr-15-2020, 08:34 AM
Last Post: Jose
  Writing a function that changes its answer based on user input SirRavenclaw 2 3,739 Dec-21-2019, 09:46 PM
Last Post: Clunk_Head
  Print the longest str from user input edwdas 5 5,683 Nov-04-2019, 02:02 PM
Last Post: perfringo
  Question about running comparisons through loop from input value Sunioj 2 3,263 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