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
#5
Hi thanks for the replies, i really appreciate it.

Quote:i= 1
while i<=5:
print("beer")
else i=6
print("sixpack")
else i=10
print("beer")

this what i initially came up with using some logic and trying solve it like a math problem while wording using english but not the computer terminology and thats what i came up with and know its wrong even though i have the solution for it but i would like to go through my code above and get it correct and understand it.

thanks.

Also i am doing list on the side aswell trying get ahead before my next class

This is the question:

Create a simple list to hold the items 1,2,3,4, creating the list “from the front” as in Slide 48.[Notice how the list is only complete when you have finished.]Use the code from Slide 50 to print out your list. (You may want to write this as a function.)

Quote:class Node:
pass

start = Node()
point = start

point.data = 1
point.next = Node()
point = point.next

point.data = 2
point.next = Node()
point = point.next

point.data = 3
point.next = Node()
point = point.next

point.data = 4
point.next = None

def func1():
point = start
print(point.data)

point = point.next
print(point.data)

point = point.next

print(point.data)
point = point.next
print(point.data)
point = point.next
print("point:", point)

func1()

And just wanted did i assemble the code properly that i got from the slide 48 and 50(read question)
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 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