Jump to content

print("Hello!")

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
7 replies to this topic

#1
Shadow21

Shadow21

    Newbie

  • Members
  • PipPip
  • 12 posts
Hi!

I'm new to programming and I just started to learn Python. So far I've only been able to make an extremely simple calculator with Python :D. I'm wanting to learn either Java or C++ after I'm comfortable with Python.

#2
opwuaioc

opwuaioc

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 216 posts
Welcome! Sounds like a good plan. :)
Something witty here.

#3
Guest

Guest

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 3,414 posts
Posted Image
Root Beer == System Administrator's Beer
Download the new operating system programming kit! (some assembly required)

#4
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
Welcome aboard! Sounds like a good plan.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#5
spyder

spyder

    Programmer

  • Members
  • PipPipPipPip
  • 120 posts
Welcome.
I started with Python too!
Going to C++ or Java is great from Python, but....
You should really learn Python first.
If you are going to go to C++ or Java really learn classes!:)

#6
Shadow21

Shadow21

    Newbie

  • Members
  • PipPip
  • 12 posts
As you guys can see I'm a huge procrastinator...

I had to go back to school so I stopped learning Python but I started again yesterday and I've gotten farther than I ever have (which isn't that far). I'm trying to do the beginner projects on here as I learn.

It sadly took me around an hour to make and fix a simple number guessing game but I also did a little more than it asked for. This is what I came up with:

#!/usr/bin/python3


import random


on = "yes"

min = 1

max = 10


while on == "yes":

	game = "yes"

	randnum = random.randint(min, max)


	while game == "yes":						#Loops game until on = no

		guess = int(input("Guess a number between 1 and 10: "))

	

		if guess == randnum:

			print("You won!")	

			on = str(input("Play again? (yes/no): "))

			while on != "yes" and on != "no":		#yes/no restriction

				on = str(input("Play again? (yes/no): "))

			game = "no"

		elif guess < randnum:

			if guess >= randnum-2:

				print("A little higher!")

			else:

				print("Higher")

		elif guess > randnum:

			if guess <= randnum+2:

				print("A little lower!")

			else:

				print("Lower")


I'm really hoping I don't procrastinate again so I can finally get better at using Python.

#7
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,118 posts
Welcome back Shadow21, your script looks pretty well defined, good job.
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.

#8
Shadow21

Shadow21

    Newbie

  • Members
  • PipPip
  • 12 posts

Alexander said:

Welcome back Shadow21, your script looks pretty well defined, good job.

Thanks and I'm glad my script looks fine. :)

I've gotten farther than I ever have with Python so I'm sure I'll stick with it. I'll probably start on a sentence generator script in a day or two.