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