Skip to content

Commit

Permalink
code
Browse files Browse the repository at this point in the history
code
  • Loading branch information
itzzmeanmol committed Oct 28, 2018
1 parent 4693d2b commit 547d687
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 61 deletions.
4 changes: 2 additions & 2 deletions SOLUTIONS/ACIIIProduct.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# author: Higor Santos de Brito Dantas
# platform: python 2.7

string = raw_input()
product = 1

for e in string:
product *= ord(e)

print product
print product
47 changes: 17 additions & 30 deletions SOLUTIONS/Find_Sum_square_Difference.py
Original file line number Diff line number Diff line change
@@ -1,34 +1,21 @@
# -*- coding: utf-8 -*-
"""
Spyder Editor
def sum_square_diff(N):
sum1 = 0
sum2 = 0
for num in range(1, N+1):
sum1 += num ** 2

This is a temporary script file.
"""
for num in range(1, N+1):
sum2 += num

message = "Pick a number:"
a = input(message)
a = int(a)
sum2 = sum2 ** 2
return abs(sum1-sum2)

if a > 10**4:
print("Number needs to be less than 10,000")
N_list = []
T = int(input())

if a <= 10**4:

#computing the sum of the squares
somma_square = 0
for i in range(1,a+1):
square1 = i**2
somma_square1 = somma_square + square1
somma_square = somma_square1

#computing the square of the sum
somma = 0
for i in range(1,a+1):
somma1 = somma + i
somma = somma1
square_somma = somma**2

#taking the absolute value of the difference
diff = abs(somma_square - square_somma)
print(diff)

for _ in range(T):
N = int(input())
N_list.append(N)

for N in N_list:
print(sum_square_diff(N), end="\n")
10 changes: 4 additions & 6 deletions SOLUTIONS/Hello world.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#include<iostream>
using namespace std;
int main()
#include<iostream.h>
void main()
{
cout<<"HELLO WORLD!"<<endl;
return 0;
}
cout<<"Hello world";
}
16 changes: 8 additions & 8 deletions SOLUTIONS/Hello_World.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include <bits/stdc++.h>
using namespace std;
int main(){
cout<<"Hello World"<<endl;
return 0;
}
#include <bits/stdc++.h>

using namespace std;

int main() {
cout << "Hello world" << endl;
return 0;
}
16 changes: 7 additions & 9 deletions SOLUTIONS/Reverse-Word.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
def main():
userInput = input('Enter a string with multiple words: ')
wordsArr = userInput.split(' ')
reversedWord = '';
for word in reversed(wordsArr):
reversedWord += word + ' '
print(reversedWord)
def reverse_word():
s = input("Enter a sentence containing multiple words: ").strip()
s = s.split()[::-1]
print(s)
s = " ".join(s)
return s

if __name__ == '__main__':
main()
print(reverse_word())
13 changes: 7 additions & 6 deletions SOLUTIONS/reverse-Word-Python.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#Get User word
user_input= raw_input("Please input your word ")
#reverse the user input
reverse_user_input =user_input[::-1]
#Print the reverse word
print ("This is reverse of your word : " + reverse_user_input)
s = input().strip(".").split(" ")
s.reverse()
for i in range(len(s)):
if i != (len(s) - 1):
print(s[i],end=" ")
else:
print(s[i],end=".")
Binary file added Screenshot 2018-10-28 at 7.18.54 PM.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 547d687

Please sign in to comment.