+ 2
Help with guessing game
Hi I'm totally new to programming could i get some help to get this to work? do i need to import something first? number = 23 running = True while running: input = int(input('Enter an integer : ')) if input == number: print 'Congratulations, you guessed it.' running = False # this causes the while loop to stop elif input < number: print 'No, it is a little higher than that.' else: print 'No, it is a little lower than that.' else: print 'Game Over.' print 'Done'
5 Respuestas
+ 3
No imports needed. You can do it like this https://code.sololearn.com/cBPpz676ThKU/?ref=app
A couple things is python 3 requires () to for the print statements and you can only have 1 else at the end not 2. Keep in mind the sololearn playground won’t loop and ask for input so you have to put all your answers in at once the first time it asks 1 per line, but if you use python on your computer it will work differently and keep asking. Also you have to indent your code in python.
+ 3
Here’s a few:
Problem 1: take in the customers food charges and their beverage charges. Add them together to get the total before the tax. Calculate the tax using 5.2% and give the price after taxes. Now calculate the tip at 15 % and add to the total. Display bill before taxes, bill including taxes, and bill with taxes and tip.
Problem 2: you have played a games 3 times and have your scores. Take in the game scores and determine what you need for the fourth score to reach 1000.
Problem 3:
You received 4 numeric grades for the semester. Grades range from 0-100. The first grade is 15% of your final grade. The second grade is 25% of your final grade. The third grade is 20% of your final grade. The fourth grade is 40% of your final grade. Take in the grades then display your final numerical grade and grade letter.
These were real homework assignments I had lol.
+ 2
thnx again, have a happy new year :)
+ 1
Ah thanks a bunch for that Arthur, I'm still having trouble getting it to run, so I tried the playground did indeed forget the () ah well noobs get better to :P
And indent (actually looked it up again how to) repetition makes perfect.
Do you maybe have ideas on what a complete starter could try next as in simple exercises?
0
what language?