Exercises for Python

+1 Erkin Öner · September 19, 2014
Hello all!

since i finished Python tutorials of Bucky, i am looking for exercises because i dont want to forget what i learned. For who just finished 1-25 tutorials which exercises you can advise?

Thank you!

Post a Reply

Replies

Oldest  Newest  Rating
+1 Aditya Singh · September 20, 2014
Hi!
1>  Why don't you try building a command line Calculator with basic mathematical functions like +, -, *, /, //, 
       %, and ^ ?

2> And then present the user with a menu asking him what operation is to be performed.

3> And then ask him to input the numbers on which the operation is to be performed?
0 Erkin Öner · September 21, 2014
Hello Aditya,

i will try your advises and will post codes here! Thank you ! :)
0 Erkin Öner · September 24, 2014
I am a bit stucked with it :ermm:  There is bunch of basic calculator videos and codes but all of them using modules. Bu i think there is nothing wrong with my code. Somehow it doesnt work. Can someone help me with this code?


#Welcome to basic calculator, let's start..

a = int(input("Enter your first number: "))
b = int(input("Enter your second number: "))

type = str(input("Please choose your calculation type: +, -, *, / "))



if type == "+":
    print("The result is: ", a + b)
elif type == "-":
    print("The result is: ", a - b)
elif type == "*":
    print("The result is: ", a * b)
elif type == "/":
    print("The result is: ", a / b)
else:
    print("The command you entered is not valid")
0 Asko O · September 24, 2014
Worked fine with Python 3.4.1 . Only thing is dividing with 0.
0 Erkin Öner · September 24, 2014
Pycharm succesfully executes code but never works really. Doesn't show what i ask in code :ermm:

I resolved it. When you use other than right click - Run Pycharm doesnt give a result. Just says executed with 0 code. Interesting...
  • 1

Python

107,282 followers
About

This section is all about snakes! Just kidding.

Links
Moderators
Bucky Roberts Administrator