Python Forum
beginner and need help with python
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
beginner and need help with python
#6
Rather than using quotes, you want to use Python tags (the yellow and blue icon beside quote)
i= 1
while i<=5:
    print("beer")
else i=6
    print("sixpack")
else i=10
    print("beer")
Else is usually used with if, and yes you will need to use if. Take your while and make is <=10, then first line after that make an if statement that tests to see if i is 6. If so, print sixpack, else print beer.
AND, you never increment i so it will always be 1, and you will get endless beer (not an entirely bad outcome).
Reply


Messages In This Thread
beginner and need help with python - by Tjay - Oct-13-2019, 07:35 PM
RE: beginner and need help with python - by buran - Oct-14-2019, 05:54 AM
RE: beginner and need help with python - by Tjay - Oct-14-2019, 05:44 PM
RE: beginner and need help with python - by jefsummers - Oct-14-2019, 06:25 PM
RE: beginner and need help with python - by Tjay - Oct-14-2019, 07:06 PM
RE: beginner and need help with python - by Tjay - Oct-14-2019, 07:23 PM
RE: beginner and need help with python - by buran - Oct-14-2019, 07:37 PM
RE: beginner and need help with python - by Tjay - Oct-14-2019, 07:50 PM

Forum Jump:

User Panel Messages

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