Python Forum
just a trial. Please wait 5 minutes before deleting this thread
Thread Rating:
  • 3 Vote(s) - 3.33 Average
  • 1
  • 2
  • 3
  • 4
  • 5
just a trial. Please wait 5 minutes before deleting this thread
#1
my question here:just a trial

#file1.py
print("HANDLING LISTS")
L = [1.2, 5.6, 7.8]
L[1]= 8.9
for x in L:print(x, end=' ')
print()  # display a blank line
for x in L:print(x)
x = 'a'
y = 'b'
print('%s....%s' % (x, y))
print("CONSTRUCTION OF A LIST ELEMENT BY ELEMENT")
value=4.5
L=[]
L[:0]=[value]
for x in L:print(x)
value=3.5
L.append(value)
value=7.4
L.append(value)
value=9.4
L.append(value)
L.sort()
for x in L:print(x, end=' ')
print()
print("length of L=", len(L))
print(L)
print("AVERAGE OF THE VALUES OF A LIST")
L=[3.5, 4.5, 7.4, 9.4]
print(L)
print("length of L=", len(L))
sum=0
for x in L:
   sum=sum+x
   print(sum)


print("the sum of the whole is: ", sum)
average=sum/len(L)
print("The average value of the whole is: ", average)
exit()
Reply
#2
If you are attempting to use code tags, you'll notice almost all your indentation is wrong. This is most likely due to posting formatted text. When pasting your code between the tags, it is always safe to use the key combination "Ctrl + Shift + V". Also, in your code, remember to use spaces (4 spaces per indentation level) NOT tabs.
If it ain't broke, I just haven't gotten to it yet.
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition
Reply
#3
(Jun-06-2017, 12:56 PM)sparkz_alot Wrote: you'll notice almost all your indentation is wrong
It's work,indentation is not wrong just a very bad coding style.
Code tag work @sylas,which i think is the point of this post.
Don't write code like this look at PEP-8.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Wait til a date and time KatManDEW 2 1,430 Mar-11-2022, 08:05 PM
Last Post: KatManDEW
  wait for the first of these events Skaperen 4 1,955 Mar-07-2022, 08:46 PM
Last Post: Gribouillis
  how to do a two-way wait Skaperen 2 1,267 Mar-04-2022, 02:31 AM
Last Post: Skaperen
  Run an app in a standalone terminal and wait until it's closed glestwid 2 2,520 Aug-30-2020, 08:14 AM
Last Post: glestwid
  python os.popen is not working for wait method elenaflorence87 0 2,006 Jul-22-2020, 12:56 PM
Last Post: elenaflorence87
  Wait for command within a process bRitch022 1 3,253 Jul-15-2020, 07:03 PM
Last Post: bRitch022
  Error SQLite objects created in a thread can only be used in that same thread. binhduonggttn 3 15,583 Jan-31-2020, 11:08 AM
Last Post: DeaD_EyE
  Could you help with this bug I have looked for like 20 minutes ryder5227 1 2,203 Sep-29-2019, 10:58 PM
Last Post: jefsummers
  Subprocess.send_signal, wait until completion plinio 5 9,062 Jun-29-2018, 12:07 PM
Last Post: plinio
  calculating the datetime objects to get the minutes chris0147 1 2,925 Apr-04-2018, 12:04 AM
Last Post: snippsat

Forum Jump:

User Panel Messages

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