Python Continuation
Hi fellow Hiveians,
Today I wanted to catalog a bit of an update on my Python practice skills! It's getting there, not as quickly as I was hoping but progress nonetheless!
Steady As She Goes
Practicing Python has been one of the things I’ve been trying to every night or every other day. The training varies but I’m making progress. Some of the things are still pretty foreign to me but I can usually figure it out. Some of the cool things to do with it is calling things in ranges and stuff. I don’t know how useful it is yet but one of these days I’ll figure out exactly what I need to use in order to do what I need.
FizzBuzz
FizzBuzz is apparently one of the common ways that companies will test a person to see their programming skills. I've encountered it twice in my brief foray into training and it's a pretty cool thing to have to figure out. It takes patience sometimes for sure!
I just learned how to insert some code into a paragraph with markdown. I was thinking what the hell character is a "back tick" only to find out it's what it known across the world as the SQUIGGLY next to the number one. Cool stuff! Pro code skills right there.
So what this particular iteration of FizzBuzz was asking for if a number is divisible by both 3 and 5 then you need to print FizzBuzz. If a number was only divisible by 3 we should print Fizz. If a number was only divisible by 5 we should print Buzz. It then counted from 1 to 15 and iterated through it until it was finished. I am still not completely sure the point of the name section below it, I've learned and read about it but I guess I just don't understand the use of it yet.
def fizzbuzz(n):
#write your code here
for i in range (1, n):
if i % 3 == 0 and if i % 5 == 0:
print("FizzBuzz")
elif i % 3 == 0:
print("Fizz")
elif i % 5 == 0:
print("Buzz")
else:
print(i)
if __name__ == '__main__':
n = int(input().strip())
fizzBuzz(n)
What was challenging is that it kept failing by only printing 1 to 14, despite the input being 15. Thankfully it took me a few minutes but I figured it out, I adjusted my code a little bit at the beginning and it worked beautifully!
for i in range (1, n+1)
That took care of that pesky problem and I was glad that I was able to figure it out. Sometimes it works out for me lol
One of the other really good things I’ve come across these past few weeks is an additional website and platform to use in order to learn the stuff. The app I’ve been using is SoloLearn but the website that I’ve started to use has been Hacker Rank. They have a different way to show you stuff but it’s good. I think there’s less hand holding with them versus SoloLearn so that’s good. Different ways to teach and learn are really good to have!
Do you want to get paid, in crypto, for searching the internet? Try using and signing up for Presearch to earn some great crypto! I've currently got 2,040 PRE tokens, with a market value of $35.13. It doesn't sound like a lot but when you search using sites like Google you get paid $0! Join Presearch to break Google's stranglehold on the internet searches. If you'd like to sign up, use my referral link!
https://www.presearch.org/signup?rid=513043
Posted with STEMGeeks
Congratulations @cmplxty! You have completed the following achievement on the Hive blockchain and have been rewarded with new badge(s) :
Your next target is to reach 19000 upvotes.
You can view your badges on your board and compare yourself to others in the Ranking
If you no longer want to receive notifications, reply to this comment with the word
STOP
Check out the last post from @hivebuzz:
Yah, do remember that the range function in Python does not include the number on the second argument (right side). It is left inclusive but not right inclusive.
Yeah I'm still learning some of these nuances! There's a lot to learn for sure so I did read it before but I'm more of a hands on person. I think that now that I've done it and realized what needed to be done to fix it, I should hopefully be able to remember it in the future.
Thanks for checking it out and dropping some wisdom! :D