Jump to content
Crawler
  • ENjoy the weekend!
  • Almost the weekennd again.
  • Finally back from a very long trip
Haec [bls]

Python for beginners!

Recommended Posts

Haec [bls]
# 1/usr/bin/env python3

import random

number = random.randint(1, 10)
tries = 1

uname = input ("What is your username?")

print("Hello", uname + ".", )

question = input ("Lets play a game? [Yes/No] ")
if question == "No":
    print("Unfortunate, Goodbye!")

if question == "Yes":
    print("I'm thinking of a number between 1 & 10")
    guess = int(input("Take a guess: "))
    if guess > number:
         print("Wrong, guess lower...")
if guess < number:
    print ("Wrong, guess higher...")
while guess != number:
    tries += 1
    guess = int(input("Try again: "))
    if guess < number:
        print("Guess higher")
    if guess > number:
        print("Guess lower")
if guess == number:
    print("Correct!, You've won $10000000! The numer was", number, \
          "and it only took", tries, "tries!")

For anybody looking to make a start in Python3 you are welcome to take a peak at this sample code used to make an extremely basic text based game. You insert your username (can be anything), type Yes or No to if you'd like to play or not and then proceed to guess a randomly generated number between 1,10. This is seen at the very top - number = random.randit (1, 10). Of course this number could be changed but the difficulty would increase. Simple code like this could be modelled to make  your very own text based adventure game, you know those ones popular when your parents were born. 

DropBox, Instagram, Spotify, Reddit, even Google all use python in their code! Whatever you can think up you can pretty much create in python which is why its such a great starting language. Of course there are better languages for different requirements but after you have learnt one language it is a lot easier to make that conversion and it is widely known that Python is one of the easiest languages to pick up.

If you're new to coding and this looks completely foreign to you then not to worry! Like all things, coding takes time to understand but it is not difficult and anybody can learn it with enough motivation and perseverance. Here are a list of websites in which you can both start and practice learning python completely free! (and various other languages)  

https://www.codecademy.com/learn/python

https://www.codementor.io/community/topic/python

https://developers.google.com/edu/python/?hl=en

http://www.pythonforbeginners.com/

Paid alternatives that are great for development are https://www.udemy.com/complete-python-bootcamp/ and https://teamtreehouse.com/library/topic:python

If you're a student you're in luck! JetBrains offers PyCharm to students completely free which is an incredibly professional piece of software in which you can create Python projects. https://www.jetbrains.com/student/ APPLY HERE for your student membership.

Have a great day and happy coding!

Haec

 

  • Like 4
  • 100 1

Share this post


Link to post
Share on other sites
Fafnir

This is something that is definitely interesting to me. I will have to take a closer look in the near future. For now I would just like to thank you for putting this out here, I appreciate it!

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Posts

    • Ejay
      Valve/Steam, in their infinite wisdom doing their absolute best to provide the worst customer service and experiences, did it again with another one of their "what the hell  were they thinking episodes" a few days ago. Apparently Valve  had issues with a scammer site or two in the Steam community which had a domain ending in ".me" .  Of course we all appreciate that they handled that in a prompt manner. Thanks Valve! However, in the spirit of Valve  ever  taking the "cheap and easy way out",  to 'handle it', they all at once, blocked every domain in the Steam community that had a   ".me" extension, including this site  -  www.ejay.me.  Thanks Valve! Eventually realizing their brain-fart moment, Valve restored/unblocked  the .me extension for the hundreds of legitimate sites (like this one),  no doubt after many of us got in their face about it. Well even so, as a result of the above  "just another day at Valve episode" , we decided to create a new domain for this site that better reflects the spirit of what Ejays Circle,  "ejay.me" is really about.  You see, this site is not all about me, Ejay ejjp, it is about all of YOU, a gathering place for all of my friends .  Therefore, we have a new domain name for the site.  Although you can still get here using the old URL, the official main domain name going forward  is,  EjaysCircle.com Thanks for your continued friendship and support. -Ejay                
    • Stranger20
      https://www.humblebundle.com/store/guacamelee-super-turbo-championship-edition    
    • Stranger20
      https://www.humblebundle.com/store/age-of-wonders-iii
    • Ejay
      So with good marketing i suppose, and a super deal, I bought Tropico 6. I admit I have Tropico1-5 and never played them but this one proclaims to be much better that the previous episodes. Well, I did not have much time with it so far (maybe an hour) but looks promising.  Now if I can only figure out how to build a bridge to connect two islands...….  
    • Ejay
      Defginition of this word please...
×

Important Information

Terms of Use