New here and I hope that I can help as much as I will help. Basically, I was tasked with writing a fizzbuzz program in Python and so far so good, except for some of the feedback I received.
Now I have to make sure that the output of my program intersects horizontally and is not printed vertically on new lines. In my opinion, and my lecturers are hinting that I need to enable a function to create lines and also delete print instructions. A.
Code below:
def fizzbuzz1 (num):
for num in range(1, num):
if (num%3 == 0) and (num%5 == 0):
print("Fizzbuzz")
elif ((num % 3) == 0):
print("Fizz")
elif ((num % 5) == 0):
print("buzz")
else :
print (num)
def main ():
while True:
num = input ("please type a number: ")
num = int (num)
print ("Please select an type what option you wish to try: A) Is this Fizz or Buzz? B) Count saying fizz/buzz/fizzbuzz")
opt = input ("Please type A or B and press enter: ")
if opt == "A":
fizzbuzz(num)
elif (opt == "a")
fizzbuzz(num)
elif (opt == "B"):
print (fizzbuzz1(num))
elif (opt == "b"):
print (fizzbuzz1(num))
main ()
I have tried a number of things, and my lecturer does not seem to be too interested in helping me. WOMP. I was encouraged to consider this exercise when I played with this piece of code:
def func(num):
value = ‘’
for x in range(...):
if .... == .... :
value += str(x) + ‘, ‘
return value[…]
, , . , . ?
. , , .
.
: , thimgs, , !
: , python?
.