Python Forum
Question about list and while function
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Question about list and while function
#1
I am trying to code a list of 10 items whose values ​​come from the equation y=a*(b-x) and complete the rest of it with 0. e.g:
a=1
b=5
list=[]
x=0
while (x<=b):
      x=x+1
      y=a*(b-x)
      break
list.append(y)
list=[1,2,3,4,5,6,0,0,0,0,0]
Reply


Messages In This Thread
Question about list and while function - by doug2019 - Oct-11-2019, 02:39 AM
RE: Question about list and while function - by adt - Oct-11-2019, 08:45 AM
RE: Question about list and while function - by adt - Oct-11-2019, 12:02 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Question on dir() function Soorya25 1 1,169 Jan-16-2023, 09:33 PM
Last Post: deanhystad
  Function not scriptable: Noob question kaega2 3 1,208 Aug-21-2022, 04:37 PM
Last Post: kaega2
  input function question barryjo 12 2,760 Jan-18-2022, 12:11 AM
Last Post: barryjo
  Question on None function in a machine learning algorithm Livingstone1337 1 2,370 Mar-17-2021, 10:12 PM
Last Post: supuflounder
  Question in python function problem saratha 1 1,475 Jul-08-2020, 04:56 PM
Last Post: jefsummers
  question about python3 print function jamie_01 5 2,688 May-25-2020, 09:58 AM
Last Post: pyzyx3qwerty
  Question about the groupby function new_to_python 7 3,273 Feb-09-2020, 07:52 AM
Last Post: perfringo
  I created a function that generate a list but the list is empty in a new .py file mrhopeedu 2 2,332 Oct-12-2019, 08:02 PM
Last Post: mrhopeedu
  Question on Join() function sduvvuri 2 2,776 Jun-02-2019, 03:55 PM
Last Post: perfringo
  about List question longmail 2 2,377 Nov-30-2018, 02:08 AM
Last Post: longmail

Forum Jump:

User Panel Messages

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