473,385 Members | 1,813 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Problems with Python code

Hello, guys! I probably shouldn't mentioned it, because in other forums no one really wanted to help me after I mentioned that I need this for my programming test at school, but I'm really desperate. I will attach my code and errors in it, I don't really understand what is wrong with these errors and how can I fix them. I am already trying to write that program for 3 days. But if I can't get pass this test, it looks like there is almost 100 percent chance for me not to make to next grade. And also don't misunderstood me- I don't want to get into job as a programmer, but I have that subject at school. And if someone really helps me, please explain as simple as you can, because I really don't understand what these errors mean. Really hope on your help, because I'm myself hopeless with this. Thank you :)))




x = int(input())
a = 12
sestdiena = x//a
sestdienaa = x%a
print(sestdiena, str(sestdienaa) + "/" + str(a))
print("Sestdien piepildīja" + sestdiena + "kastītes, nepilnajā kastītē bija" + sestdienaa + " olas .")

Traceback (most recent call last):
File "jdoodle.py", line 6, in <module>
print("Sestdien piepildīja" + sestdiena + "kastītes, nepilnajā kastītē bija" + sestdienaa + " olas .")
TypeError: can only concatenate str (not "int") to str



x = int(input())
y = int(input())
a = 12
sestdiena = x//a
sestdienaa = x%a
print(sestdiena, str(sestdienaa) + "/" + str(a))
print("Sestdien piepildīja" + sestdiena + "kastītes, nepilnajā kastītē bija" + sestdienaa + " olas .")




File "jdoodle.py", line 2, in <module>
y = int(input())
ValueError: invalid literal for int() with base 10: ''
Nov 14 '20 #1
2 2408
Sariel
1
EDIT: Deleted my answer due to rules about course work.
Nov 14 '20 #2
dev7060
636 Expert 512MB
TypeError: can only concatenate str (not "int") to str
Use str() to concatenate a string with an int.
Expand|Select|Wrap|Line Numbers
  1. print("Sestdien piepildīja " + str(sestdiena) + " kastītes, nepilnajā kastītē bija " + str(sestdienaa) + " olas .")
ValueError: invalid literal for int() with base 10: ''
The provided argument can't be parsed as int. Look out for the provided inputs.
Nov 14 '20 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Chris McKeever | last post by:
I am trying to modify the Mailman Python code to stop mapping MIME-types and use the extension of the attachment instead. I am pretty much clueless as to what I need to do here, but I think I have...
5
by: beliavsky | last post by:
How do you keep Python code properly indented as you modify it? I use an Emacs-type editor that has a Python mode, so the initial indenting is easy. If I later want to put a 'for' loop (or an 'if'...
9
by: F. GEIGER | last post by:
I've dev'ed a Python prototype of an app, that besides the internals making it up has a gui. While test-driven dev'ing the app's internals in Python is fun as usual, dev'ing the GUI is not so...
6
by: nell | last post by:
Hi all, I've developed a testing application in python, and should supply it in a way that no one (lets say they are regular users) will understand it and edit it. The application source is all...
64
by: Bayazee | last post by:
hi can we hide a python code ? if i want to write a commercial software can i hide my source code from users access ? we can conver it to pyc but this file can decompiled ... so ...!! do you...
13
by: Steven Bethard | last post by:
Jean-Paul Calderone <exarkun@divmod.comwrote: Interesting. Could you give a few illustrations of this? (I didn't run into the same problem at all, so I'm curious.) Steve
3
by: kaens | last post by:
Hey everyone, I'm relatively new to python - I actually picked it up to see how quickly I could start building non-trivial apps with it. Needless to say, I was quite pleased. Anyhow, I'm...
23
by: Python Maniac | last post by:
I am new to Python however I would like some feedback from those who know more about Python than I do at this time. def scrambleLine(line): s = '' for c in line: s += chr(ord(c) | 0x80)...
12
by: WaterWalk | last post by:
Hello. I wonder what's the effective way of figuring out how a piece of python code works. With C I often find it very useful to be able to run the code in step mode and set breakpoints in a...
2
by: John Nagle | last post by:
koblas wrote: PyPy was supposed to help, but that project has been dragging on for half a decade now. Personally, I think the Shed Skin approach is more promising. PyPy has too many different...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.