The Sum of Numbers (WSQ – 04)

--Originally published at TC1017 (Python3) – Titel der Website

In this WSQ we had to write a program, which asks you for a range of integers and than prints the sum of the numbers in that range.

For example the range from 6 to 10.

For Mathematical operations lime this there is a formula.

Formel.PNG

But this formula is from 1 – n…

If you have something from n – m you have to use this formula 2 times and then build the difference.

You can see this operation in my program.

WSQ04 - SourceCode - SumNumbers.PNG

 

The result:

WSQ04 - Ergebnis - SumNumber.PNG


Guess the random number (WSQ 03)

--Originally published at TC1017 (Python3) – Titel der Website

The task was to write a program were the User have to guess the random number between 1 – 100. The random number is to be selected by the program.

After the guess the program have to tell you if your guess is to low or to high. And every time when the user do a guess, the sum of the guesses should be counted. When the User finally guesses the correct number, the program have to say that it is the correct number with the sum of the tryings.

 

The problem

Before a could start to write the program i had to inform myself for the issue with the random number. I never had a task like this with eclipse before. So I had no idea how program a random number between 1 – 100.

In my internet research i found a simple video for this problem.

 

The biggest challenge in this program was to build a loop while the user dont get the random number wich was chosen from the program.

The keyword while helped me a lot in this case. So i just choose a while loop wich i knew from Java programming.

The program

WSQ03 - SourceCode- RandomNumber.PNG

 

The result

WSQ03 - Ergebnis - Random Number.PNG


Temperature – WSQ-02 (Python)

--Originally published at TC1017 (Python3) – Titel der Website

Hello students and friends,

i wrothe a new programm. It is about the temperature in Farenheit and in Celcius.

 

WSQ02 - SourceCode - Temperature.PNG

Line 3 is prompt. The Keyword input want something from the User. (In this Case the Temperature in Farenheit).

You may think that for example the number 100 will be safed as an int. But python3 safe every singel tocken as a String.

For showing the Temperature in Celcius, it is important to convert the String f in a float.

WQS02 - Ergebnis - Temperature.PNG

This is the result of my Source Code.

 

Best regards

Sercan Asker


WSQ 01 – Fun with Numbers (Week 02)

--Originally published at TC1017 (Python3) – Titel der Website

Hello students and friends,

 

my first Blog entry will be about: how to do mathematical calculations with Python3.

Why do I use Python3?

Well, I had a conversation with Ken. He suggested me, that all exercises for C++ can be done with Python3 as well.

 

Python is a universal, higher-lebel programming language. It is easy to read and has a tight programming style.

For example, Blocks are not structured by braces. They are structured by indentations.

 

To the Task

 

The task was, to choose 2 randome numbers and calculate the sum, difference, product, division and the modulo (the rest of a division).

 

The source code

SourceCode - FunWithNumbers.PNG

 

The result

Ergebnis - FunWithNumbers.PNG

 

How I ran into the matter

This was the first time, that i had something to do with Phython. So i watched a lot of tutorials to understand, how the language is working. I wrote the source code with Atom.

The special feature of the programm is, that all languages can be programmed with it. It is only important, with witch end the file is saved.

For Python3 the ending is .py. For C++ for example .cpp.

 

I hope you enjoy my first Blog entry

Best regards

Sercan Asker

 

 

 

 

 

 


A little bit of math with programming

--Originally published at GTO

This is the first program I made after setting up my software and programed “Hello World” and since that I have been reading and searching information about programming in C++ because I have never used it before, I do have a little bit of experience programming but not in C++, it has not been very difficult neither easy.

This program is very basic, teacher Ken asked us to made something that: Ask the user for two integer values, then use those two values to calculate and show the following:

  • The sum of the two numbers.
  • The difference of the two numbers.
  • The product of the two numbers.
  • The integer based division of the two numbers (so no decimal point). First divided by second.
  • The remainder of integer division of the two numbers.

So this is what I made:

Screen Shot 2017-08-16 at 9.03.13 AM

I already had an idea of how to start something in C++ thanks to “Hello World” but I needed to look up for information about the variables, the operators and how to show the results in the book: “How to Think Like a Computer Scientist, C++ Version”, Downey, Allen B. 2012.

My code is:

#include <iostream>
using namespace std;

int main ()
{
int a;
cout << “Please enter an integer value: “;
cin >> a;

int b;
cout << “Please enter another integer value: “;
cin >> b;

 

cout << ” their sum is ” << a+b << “.\n”; //The sum of the two numbers.
cout << ” their difference is ” << a-b << “.\n”; //The difference of the two numbers.
cout << ” their product is ” << a*b << “.\n”; //The product of the two numbers.
cout << ” their int division is ” << a/b << “.\n”; //The integer based division of the

Continue reading "A little bit of math with programming"

Getting ready for programming WSQ-00

--Originally published at GTO

During the first week of my programming course I set up all the tools that im going to be using during the course and ideally after my course also. I have been interested in programming and learning how to make my own programs, websites, etc. I think it would not be very difficult for me to learn about this topic.

As a code editor I installed Atom which teacher Ken recommended us. And I already got Bash installed in my laptop so it seems I am ready to program, just need to start learning how-to.

-GTO

Screen Shot 2017-08-16 at 8.57.45 AM

#teclife#WSQ00