forked from werhereitacademy/Python_Modul_Week_1
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkahraman_week1.py
More file actions
45 lines (33 loc) · 1.3 KB
/
kahraman_week1.py
File metadata and controls
45 lines (33 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# week_1_houswerk
# Question 1: Write a Python code that prints numbers from 1 to 10 on the screen.
# for i in range(1,11):
# print(i)
# Question 5: Write a Python program that takes a positive integer input from the user and calculates its factorial. Factorial is the product of all positive integers between a number itself and 1.
# For example: if the user entered 5, the program should give the following output:
# Enter a number from the user: 5
# Factorial: 120
# number = int(input('please write a number: '))
# factorial = 1
# k = 1
# while k <= number:
# factorial *= k
# k += 1
# print('factorial ', number,' = ', factorial)
# Question 9: How to create a combination of loop and conditional statement that takes a word
# input from the user and checks whether that word is a palindrome (the same when read backwards)?
# word = input('please write a word: ')
# if word.lower() == word[::-1].lower():
# print(word,' is a palindrome')
# else:
# print(word, " is not a palindrome")
# hacker rank question
# def diff(x,y):
# return x-y
#def multiply(x,y):
# return x*y
#def divide(x,y):
# return x/y
#if __name__ == '__main__':
# a = int(input())
# b = int(input())
# print(sum([a,b]), '\n' ,diff(a,b) , '\n', multiply(a,b), '\n', divide(a,b))