Python Forum
Please, help to identify the mistake in the code
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Please, help to identify the mistake in the code
#5
(Jun-21-2017, 10:45 PM)zivoni Wrote: I would guess that problem is with
 while len(str1) < 10:
      str1 = str1 + ""
Your first str1 has length 2 and adding empty string does not increase it, so its infinite loop ...

You probably wanted to use
       str1 = str1 + " " # notice space inside quotes
You should check basic string formating and perhaps zip function - you could use constructs like
for ts, fore in zip(tsv, forecast):
   print("{}{:10}{:10}".format(ts, fore, ts - fore))
to shorten your code.

Thank you very much for your answer! The problem was in
       str1 = str1 + " " # notice space inside quotes
Reply


Messages In This Thread
RE: Please, help to identify the mistake in the code - by Alberto - Jun-22-2017, 09:52 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  identify not white pixels in bmp flash77 17 2,272 Nov-10-2023, 09:21 PM
Last Post: flash77
  [Solved] Please, help me find a simple mistake AlekseyPython 2 1,702 Jun-17-2021, 12:20 PM
Last Post: AlekseyPython
  [split] Could you please clarify where i did mistake also how run without admin right Abubakkar 1 1,753 Jun-14-2021, 09:32 AM
Last Post: Larz60+
  guys please help me , pycharm is not able to identify my xlsx file CrazyGreenYT7 1 1,971 Jun-13-2021, 02:22 PM
Last Post: Larz60+
  Need to identify only files created today. tester_V 5 4,554 Feb-18-2021, 06:32 AM
Last Post: tester_V
  Please help to me to find my mistake in code leonardin 2 1,801 Nov-29-2020, 04:17 PM
Last Post: Larz60+
  minor mistake in code for factorial spalisetty06 2 1,854 Aug-22-2020, 05:00 PM
Last Post: spalisetty06
  Simple mistake about for Nomatter 4 2,183 Jul-16-2020, 02:24 PM
Last Post: Nomatter
  Install Mistake jlerette5 1 1,859 Feb-18-2020, 12:19 AM
Last Post: jefsummers
  Need to identify sheet color in excel workbook chewy1418 2 2,449 Feb-14-2020, 03:26 PM
Last Post: chewy1418

Forum Jump:

User Panel Messages

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