Python Forum
New to Python - tiny coding assistance on user input function and assign to variable
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
New to Python - tiny coding assistance on user input function and assign to variable
#2
size_input would be the result of user input
size_input = input('what size beverage (S,M,L)')
you are required to then check that the value of size_input is one of (S,M,L), if it is simply just
size = size_input
otherwise
size = 'S'
and then
return size
Reply


Messages In This Thread
RE: New to Python - tiny coding assistance on user input function - by Yoriz - Mar-23-2019, 06:54 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to calculate tax with a variable input and if else afefDXCTN 12 22,707 Mar-15-2024, 01:58 AM
Last Post: nave
Question Need help with NumPy Histogram function coding Triikey 1 915 May-15-2023, 01:45 PM
Last Post: deanhystad
  How to create a menu and execute a function based on user selection in python? Thedarkphoenix 1 1,312 Nov-23-2022, 07:53 PM
Last Post: Larz60+
Question Simulate an answer based on user input [Beginner needs guidance] Bombardini 1 1,280 Nov-12-2022, 03:47 AM
Last Post: deanhystad
  Input function Fabio87 11 5,926 Apr-29-2022, 03:50 PM
Last Post: Alex143
  [split] How to calculate tax with a variable input and if else rokemas 1 2,104 Dec-28-2020, 06:53 AM
Last Post: buran
  Print user input into triangle djtjhokie 1 2,361 Nov-07-2020, 07:01 PM
Last Post: buran
  Python variable and function usage at a time prasanthbab1234 14 5,057 Sep-24-2020, 01:48 PM
Last Post: prasanthbab1234
  Changing Directory based on user input paulmerton4pope 13 7,962 Aug-14-2020, 11:48 AM
Last Post: GOTO10
  how to add the user input from file into list wilson20 8 4,298 May-03-2020, 10:52 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

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