Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Question about loop
#1
Hey everyone, I need help.
I'm creating a basic script that works like this:
The user gets a pokémon, then have to input +1 to increase its level until level 10, after the condition is true the user will be able to evolve it. For now I have this:
inicio = str(input('Input 1 to start:'))
poke = 'Pokémon'
level = 1
começou = 'You got a pokémon. Input +1 to increase its level!'
lvlup = 'Congratulations! Your pokémon grew to level: '
if inicio == '1':
 aaa = str(input(começou))
 começou = aaa
 if começou == '+1':
   print (lvlup + str(level))
   level += 1
 else:
   print('You have to input +1!')
I have no idea how can I do the while loop in this code, because I need the code to "restart" everytime the level up message is displayed.
Can someone give me some help so I can be able to finish this code please?

Thanks!
Reply


Messages In This Thread
Question about loop - by Pires - Jul-23-2017, 12:01 AM
RE: Question about loop - by ichabod801 - Jul-23-2017, 02:07 AM
RE: Question about loop - by Pires - Jul-23-2017, 02:27 AM
RE: Question about loop - by ichabod801 - Jul-23-2017, 02:49 AM
RE: Question about loop - by Pires - Jul-23-2017, 03:01 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Many iterations for loop question adesimone 9 1,972 Nov-12-2022, 07:08 PM
Last Post: deanhystad
  Please check whether the code about the for loop question is correct. (SyntaxError) lilliancsk01 10 2,775 Nov-08-2022, 01:25 PM
Last Post: deanhystad
  Beginner Python Question: FIzz Buzz using while loop camoyn13 2 1,931 Sep-20-2022, 09:00 AM
Last Post: deanhystad
  Repeat question (for loop) rs74 7 6,636 Jun-17-2020, 03:17 PM
Last Post: rs74
  Question about running comparisons through loop from input value Sunioj 2 2,470 Oct-15-2019, 03:15 PM
Last Post: jefsummers
  while loop question Tripler 4 3,044 Jul-24-2018, 06:37 AM
Last Post: buran
  Loop question kraven 3 3,741 Sep-10-2017, 07:31 AM
Last Post: wavic
  Udacity while loop question liquidmetalrob 6 5,473 Jul-21-2017, 02:56 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

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