/
main.py
89 lines (60 loc) · 2.11 KB
/
main.py
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# This is a sample Python script.
# Press Shift+F10 to execute it or replace it with your code.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.
def print_hi(name):
# Use a breakpoint in the code line below to debug your script.
print(f'Hi, {name}') # Press Ctrl+F8 to toggle the breakpoint.
if name.lower().__contains__("n"):
print("You are a trouble some fellow")
# Press the green button in the gutter to run the script.
name = input("What is your name? ")
print_hi(f"{name.lower()}")
Red = "Red"
Blue = "Blue"
listOfItems = []
color = input("What's your favourite color? ")
def printer():
if len(listOfItems) == 0:
print("list is currently empty")
if str(color) == Red.lower():
print(f"if you chose {color} then you are wild")
# See PyCharm help at https://www.jetbrains.com/help/pycharm/
elif str(color) == Blue.lower():
print(f"if you chose {color} then you are cool")
else:
print("we currently don't have a match for your color")
printer()
def adder(sth):
listOfItems.insert(0, sth)
shop = input("Name sth you'll like to shop for and separate them with space: ")
items = shop.split(" ")
adder(items)
arrange = []
blud = ""
lettersA = []
for item in items:
arrange.append(item)
splitItems = item.split() # Split the item into separate strings
for split in splitItems:
print(split)
if split.__contains__("a"):
a = split.__contains__("a")
lettersA.append(a)
print(lettersA)
# print("".join(item))
boolean = "true"
class Calculator:
def addingFunc(number, sec):
print(number + sec)
def subtractFunc(number, sec):
print(number - sec)
while boolean or True:
numb = input("enter a number: ")
secnumb = input("enter a second number: ")
enteredNumb = int(numb)
secenteredNumb = int(secnumb)
sign = input("choose a sign: + or -: ")
if str(sign).lower() == "+":
Calculator.addingFunc(enteredNumb, secenteredNumb)
if str(sign).lower() == "-":
Calculator.subtractFunc(enteredNumb, secenteredNumb)