- Joined
- 9 Apr 2012
- Posts
- 13,159
Pascal (Delphi) is what we use in my Computing college at College. It's a very good introductory language and will set you up for other languages later on.
I disagree. It's perfectly feasible to learn C++ first. Also make sure to get the C++11 edition of those books (or any other C++ book...)
I disagree. It's perfectly feasible to learn C++ first.
Also make sure to get the C++11 edition of those books (or any other C++ book...)
I realise I'm not answering your question but if I were you I wouldn't even bother looking at the Java/c++ books until you've spent a lot of time with python. The different syntax/keywords/etc will only confuse matters until you have a firm grasp of the key concepts.
I would suggest going through some more online tasks/tutorials for python, maybe set yourself a project you can work towards.
Once you are comfortable with python and oop, I don't think you would find c++ particularly difficult - the more you code, the easier it is to pick up other languages.
Also is there any way I can convert a .py file to an .exe?
I tried using py2exe but it said that I didn't have the right version.
# User Input
print("-" * 80)
print("-" * 34 , "!User Input!" , "-" * 34)
print("-" * 34 , "!By Daniel James!" , "-" * 29)
print("-" * 80)
ready = input("Are you ready?: ")
if ready == "yes" or "YES":
print("Prepare yourself for the mission that determines " \
+ "whether or not you are worthy. " + "COME WITH ME IF YOU " \
+ "WANT TO LIVEEE!!")
name = input("\nHello there friend, what's your name? ")
print(name)
print("Hi, ", name)
age = input("\nHow old are you, young padawan? ")
age = int(age)
print(age)
print(age , "huh? I definitely think you shall suffice, squire!")
attention = ("This service requires your utmost attention. " \
+ "So pay CLOSE scrutiny.")
print(attention)
weight = input("\nHow much do you weigh in pounds?")
weight = int(weight)
print(weight)
weight_jupiter = weight * 2.54
weight_saturn = weight * 1.08
weight_uranus = weight * 0.91
weight_neptune = weight * 1.19
weight_pluto = weight * 0.06
weight_moon = weight * 0.17
weight_venus = weight * 0.91
weight_mercury = weight * 0.38
weight_mars = weight * 0.38
print("On Jupiter, you'd weigh " , weight_jupiter , "pounds.")
print("On Saturn, you'd weigh " , weight_saturn , "pounds")
print("On Uranus, you'd weigh " , weight_uranus , "pounds")
print("On Neptune, you'd weigh " , weight_neptune , "pounds")
print("On Pluto, you'd weigh " , weight_pluto , "pounds")
print("On the Moon, you'd weigh " , weight_moon , "pounds")
print("On Venus, you'd weigh " , weight_venus , "pounds")
print("On Mercury, you'd weigh " , weight_mercury , "pounds")
print("On Mars, you'd weigh " , weight_mars , "pounds")
print("That's a lot of information to take in! Henceforth we " \
+ "shall resume the preparation of our mission in the near " \
+ "future!. See you soon, marine.")
else:
print("God damn you little wretch, wasting my time." \
+ "I don't have time for scum like you.")
input("\n\nPress the enter key to exit.")
dee, use code tagsthat's a nightmare to read
also, some people might put y/Y for yes
I'll have a look for some compiling solutions for you. They do all seem to be broken though or have some major issues.![]()
Ah. I knew there'd be a way around typing them all out. How would I go about this? I'm only up to chapter 3 in the book so I'm sure I'll find out soon enough.As a simple extension dee you could look at using a basic array to store the weight factors and use those for the outputs.
The one factor I've found the most fun is finding and fixing syntax errors within a program
That won't last long!![]()
Glad to hear you're enjoying it tho.
If your learning python there are 3 free books here if you want to check them out when you have finished your current book.
http://inventwithpython.com/
Ah. I knew there'd be a way around typing them all out. How would I go about this? I'm only up to chapter 3 in the book so I'm sure I'll find out soon enough.
weight = "user input"
weight_dic = { 'Jupiter': 2.54, 'Saturn': 1.08, 'Uranus': 0.91, 'Neptune': 1.19, 'Pluto' : 0.06, 'the Moon': 0.17, 'Venus': 0.91, 'Mercury': 0.38, 'Mars': 0.38}
for key, value in weight_dic.items():
print ("On " + key + ", you'd weigh " + str(weight * value) + "pounds.")
I see. So I'm basically creating my own dictionary within the program, that's pretty epic, I'm sure I'll learn it at some point in the book; I don't want to get writing loads of lines of codes that I have no idea what their function is, but I do get that. I'll probably look at creating a proper trivia questionnaire at some point, the next chapter in the book deals with the 'while' function so I could use that to loop people back to the question to try again if they get it wrong, say if I'm doing a multiple option question.I need to find a way of exporting to exe too so i'll be playing around over the next month trying to find a wayI'll let you know if I do.
As for the array, in python it would be called a dictionary. I'm pretty new to Python myself, working through codeacademy and a few books but it'd be something like this:
Code:weight = "user input" weight_dic = { 'Jupiter': 2.54, 'Saturn': 1.08, 'Uranus': 0.91, 'Neptune': 1.19, 'Pluto' : 0.06, 'the Moon': 0.17, 'Venus': 0.91, 'Mercury': 0.38, 'Mars': 0.38} for key, value in weight_dic.items(): print ("On " + key + ", you'd weigh " + str(weight * value) + "pounds.")
for Python 3
The for loop just cycles through the dictionary (weight_dic) line by line and prints out the set string + the 2 bits of info (the key and value).
Might be an even better way of doing it, not sure but I'm sure a more experienced programmer can help
Edit: I'd be much better at this if I could put as much effort into learn as I do into solving/looking in to things like thislol